Class Strings
- java.lang.Object
-
- org.eclipse.emf.compare.provider.spec.Strings
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
elide(String original, int max, String suffix)
Shorten the givenoriginal
string and append the givensuffix
if it is longest than the definedmax
length minus the length of thesuffix
.static String
removeLineBreaks(String original)
Removes line-breaks (\r\n or \r or \n) from the givenoriginal
and replaces it with blanks.
-
-
-
Method Detail
-
elide
public static String elide(String original, int max, String suffix)
Shorten the givenoriginal
string and append the givensuffix
if it is longest than the definedmax
length minus the length of thesuffix
.The returned String length will always be in
Math.min(original.length, max)
.- Parameters:
original
- the original string to elide if necessary.max
- the maximum length of the returned string.suffix
- the suffix to append in case the original String is too long.- Returns:
- the elided string or the original string.
-
removeLineBreaks
public static String removeLineBreaks(String original)
Removes line-breaks (\r\n or \r or \n) from the givenoriginal
and replaces it with blanks.- Parameters:
original
- the original string to remove line breaks from.- Returns:
- the string without line breaks but blanks instead.
- Since:
- 4.1
-
-