Reformat and correct the indentation
This commit is contained in:
parent
647e4ffe0e
commit
f5a18c6dca
@ -49,11 +49,11 @@ public class LTrimRTrim {
|
||||
}
|
||||
|
||||
public static String whileRtrim(String s) {
|
||||
int i = s.length()-1;
|
||||
int i = s.length() - 1;
|
||||
while (i >= 0 && Character.isWhitespace(s.charAt(i))) {
|
||||
i--;
|
||||
}
|
||||
return s.substring(0,i+1);
|
||||
return s.substring(0, i + 1);
|
||||
}
|
||||
|
||||
private static boolean checkStrings(String ltrim, String rtrim) {
|
||||
@ -84,11 +84,13 @@ public class LTrimRTrim {
|
||||
}
|
||||
|
||||
public static String patternLtrim(String s) {
|
||||
return LTRIM.matcher(s).replaceAll("");
|
||||
return LTRIM.matcher(s)
|
||||
.replaceAll("");
|
||||
}
|
||||
|
||||
public static String patternRtrim(String s) {
|
||||
return RTRIM.matcher(s).replaceAll("");
|
||||
return RTRIM.matcher(s)
|
||||
.replaceAll("");
|
||||
}
|
||||
|
||||
// Pattern matches() with replaceAll
|
||||
@ -100,13 +102,14 @@ public class LTrimRTrim {
|
||||
return checkStrings(ltrim, rtrim);
|
||||
}
|
||||
|
||||
|
||||
public static String guavaLtrim(String s) {
|
||||
return CharMatcher.whitespace().trimLeadingFrom(s);
|
||||
return CharMatcher.whitespace()
|
||||
.trimLeadingFrom(s);
|
||||
}
|
||||
|
||||
public static String guavaRtrim(String s) {
|
||||
return CharMatcher.whitespace().trimTrailingFrom(s);
|
||||
return CharMatcher.whitespace()
|
||||
.trimTrailingFrom(s);
|
||||
}
|
||||
|
||||
// Guava CharMatcher trimLeadingFrom / trimTrailingFrom
|
||||
|
Loading…
x
Reference in New Issue
Block a user