Methods Summary |
---|
public static java.lang.String | stripBack(java.lang.String s, char c)General-purpose utility function for removing
characters from back of string
while (s.length() > 0 && s.charAt(s.length() - 1) == c) {
s = s.substring(0, s.length() - 1);
}
return s;
|
public static java.lang.String | stripBack(java.lang.String s, java.lang.String remove)General-purpose utility function for removing
characters from back of string
boolean changed;
do {
changed = false;
for (int i = 0; i < remove.length(); i++) {
char c = remove.charAt(i);
while (s.length() > 0 && s.charAt(s.length() - 1) == c) {
changed = true;
s = s.substring(0, s.length() - 1);
}
}
} while (changed);
return s;
|
public static java.lang.String | stripFront(java.lang.String s, char c)General-purpose utility function for removing
characters from front of string
while (s.length() > 0 && s.charAt(0) == c) {
s = s.substring(1);
}
return s;
|
public static java.lang.String | stripFront(java.lang.String s, java.lang.String remove)General-purpose utility function for removing
characters from front of string
boolean changed;
do {
changed = false;
for (int i = 0; i < remove.length(); i++) {
char c = remove.charAt(i);
while (s.length() > 0 && s.charAt(0) == c) {
changed = true;
s = s.substring(1);
}
}
} while (changed);
return s;
|
public static java.lang.String | stripFrontBack(java.lang.String src, java.lang.String head, java.lang.String tail)General-purpose utility function for removing
characters from the front and back of string
int h = src.indexOf(head);
int t = src.lastIndexOf(tail);
if (h == -1 || t == -1) return src;
return src.substring(h + 1, t);
|