Android examples for java.lang:String Search
find First Word Index
public class Main { public static final String WHITESPACE = "\\s+"; public static int findFirstWordIndex(CharSequence sentence) { for (int i = 0; i < sentence.length(); i++) { if (!String.valueOf(sentence.charAt(i)).matches(WHITESPACE)) { return i; }/*from w ww .jav a 2 s. com*/ } return 0; } }