public final CharSequence nextToken(CharSequence csq,CharSet charSet){
  int n=csq.length();
  for (int i=index; i < n; i++) {
    if (!charSet.contains(csq.charAt(i))) {
      int j=i;
      for (; (++j < n) && !charSet.contains(csq.charAt(j)); ) {
      }
      index=j;
      return csq.subSequence(i,j);
    }
  }
  index=n;
  return null;
}

public final CharSequence nextToken ( CharSequence csq , CharSet charSet ) { int n = csq . length ( ) ; for ( int i = index ; i < n ; i ++ ) { if ( ! charSet . contains ( csq . charAt ( i ) ) ) { int j = i ; for ( ; ( ++ j < n ) && ! charSet . contains ( csq . charAt ( j ) ) ; ) { } index = j ; return csq . subSequence ( i , j ) ; } } index = n ; return null ; }
returns the subsequence from the specified cursor position not holding any of the characters specified . for example : [ code ] charsequence csq = " this is a test " ; for ( charsequence token ; ( token = cursor . nexttoken ( csq , charset . whitespace ) ) ! = null ; ) { system . out . println ( token ) ; / / prints one word at a time . } [ / code ]
