List of utility methods to do String Search
int | safeIndexOf(String s, String search) safe Index Of final int i = s.indexOf(search); if (i == -1) { return s.length(); return i; |
int | indexOf(String str, String searchStr) index Of if (str == null || searchStr == null) { return -1; return str.indexOf(searchStr); |
int | skipSpaces(String s, int start) Skips any spaces at or after start and returns the index of first non-space character; int limit = s.length(); int i = start; for (; i < limit; i++) { if (s.charAt(i) != ' ') { break; return i; ... |
int | nestedIndexOf(final String s, final int startPos, final String open, final String close) nested Index Of int depth = 0; for (int i = startPos; i < s.length();) { if (s.startsWith(close, i)) { if (depth == 0) { return i; } else { --depth; i += close.length(); ... |
int | findFirstNotOf(String str, String chars) find First Not Of return findOf(str, chars, 0, (str.length() - 1), 1, false);
|
int | findFirstOf(String str, String chars) find First Of return findOf(str, chars, 0, (str.length() - 1), 1, true);
|
int | findLastNotOf(String str, String chars) find Last Not Of return findOf(str, chars, (str.length() - 1), 0, -1, false);
|
int | findLastOf(String str, String chars) find Last Of return findOf(str, chars, (str.length() - 1), 0, -1, true);
|
String | firstCharUpper(String myString) first Char Upper if (myString != null && myString.length() > 1) { char[] stringArray = myString.toCharArray(); stringArray[0] = Character.toUpperCase(stringArray[0]); myString = new String(stringArray); return myString; |
int | lastIndexNotOf(String str, String chars, int fromIndex) Finds the last index in str of a character not in the characters in 'chars' (similar to ANSI string.find_last_not_of). fromIndex = Math.min(fromIndex, str.length() - 1); for (int pos = fromIndex; pos >= 0; pos--) { if (chars.indexOf(str.charAt(pos)) < 0) { return pos; return -1; |