Package org.eclipse.jetty.toolchain.test
Class StringMangler
- java.lang.Object
-
- org.eclipse.jetty.toolchain.test.StringMangler
-
public final class StringMangler extends java.lang.Object
Collection of utility methods for manipulating Strings for zen purposes.
-
-
Constructor Summary
Constructors Constructor Description StringMangler()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
condensePackageString(java.lang.String classname)
Condenses a classname by stripping down the package name to just the first character of each package name segment.static java.lang.String
maxStringLength(int max, java.lang.String raw)
Smash a long string to fit within the max string length, by taking the middle section of the string and replacing them with an ellipsis "..."
-
-
-
Method Detail
-
condensePackageString
public static java.lang.String condensePackageString(java.lang.String classname)
Condenses a classname by stripping down the package name to just the first character of each package name segment.Examples: "org.eclipse.jetty.test.FooTest" = "oejt.FooTest" "org.eclipse.jetty.server.logging.LogTest" = "oejsl.LogTest"
- Parameters:
classname
- the fully qualified class name- Returns:
- the condensed name
-
maxStringLength
public static java.lang.String maxStringLength(int max, java.lang.String raw)
Smash a long string to fit within the max string length, by taking the middle section of the string and replacing them with an ellipsis "..."Examples: .maxStringLength( 9, "Eatagramovabits") == "Eat...its" .maxStringLength(10, "Eatagramovabits") == "Eat...bits" .maxStringLength(11, "Eatagramovabits") == "Eata...bits"
- Parameters:
max
- the maximum size of the string (minimum size supported is 9)raw
- the raw string to smash- Returns:
- the ellipsis'd version of the string.
-
-