spyglass/src/main/java/com/linkedin/android/spyglass/tokenization/impl/WordTokenizer.java
public boolean onlyLettersOrDigits(final @NonNull CharSequence input, final int numCharsToCheck, final int start) {

        // Starting position must be within the input string
        if (start < 0 || start > input.length()) {
            return false;
        }

        // Check the first "numCharsToCheck" characters to ensure they are a letter or digit
        for (int i = 0; i < numCharsToCheck; i++) {
            int positionToCheck = start + i;
            // Return false if we would throw an Out-of-Bounds exception
            if (positionToCheck >= input.length()) {
                return false;
            }
            // Return false early if current character is not a letter or digit
            char charToCheck = input.charAt(positionToCheck);
            if (!Character.isLetterOrDigit(charToCheck)) {
                return false;
            }
        }

        // First "numCharsToCheck" characters are either letters or digits, so return true
        return true;
    }
public boolean onlyLettersOrDigits(final @NonNull CharSequence input, final int numCharsToCheck, final int start) {

        // Starting position must be within the input string
        if (start < 0 || start > input.length()) {
            return false;
        }

        // Check the first "numCharsToCheck" characters to ensure they are a letter or digit
        for (int i = 0; i < numCharsToCheck; i++) {
            int positionToCheck = start + i;
            // Return false if we would throw an Out-of-Bounds exception
            if (positionToCheck >= input.length()) {
                return false;
            }
            // Return false early if current character is not a letter or digit
            char charToCheck = input.charAt(positionToCheck);
            if (!Character.isLetterOrDigit(charToCheck)) {
                return false;
            }
        }

        // First "numCharsToCheck" characters are either letters or digits, so return true
        return true;
    }
public boolean onlyLettersOrDigits ( final @ NonNull CharSequence input , final int numCharsToCheck , final int start ) { // Starting position must be within the input string if ( start < 0 || start > input . length ( ) ) { return false ; } // Check the first "numCharsToCheck" characters to ensure they are a letter or digit for ( int i = 0 ; i < numCharsToCheck ; i ++ ) { int positionToCheck = start + i ; // Return false if we would throw an Out-of-Bounds exception if ( positionToCheck >= input . length ( ) ) { return false ; } // Return false early if current character is not a letter or digit char charToCheck = input . charAt ( positionToCheck ) ; if ( ! Character . isLetterOrDigit ( charToCheck ) ) { return false ; } } // First "numCharsToCheck" characters are either letters or digits, so return true return true ; }
Given a string and starting index, return true if the first "numCharsToCheck" characters at
the starting index are either a letter or a digit.

@param input           a {@link CharSequence} to test
@param numCharsToCheck number of characters to examine at starting position
@param start           starting position within the input string

@return true if the first "numCharsToCheck" at the starting index are either letters or digits
Given a string and starting index return true if the first numCharsToCheck characters at the starting index are either a letter or a digit .