spyglass/src/main/java/com/linkedin/android/spyglass/tokenization/impl/WordTokenizer.java
public char getExplicitChar(final @NonNull CharSequence text, final int cursor) {
        if (cursor < 0 || cursor > text.length()) {
            return (char) 0;
        }
        SpannableStringBuilder ssb = new SpannableStringBuilder(text);
        int start = getSearchStartIndex(ssb, cursor);
        int i = cursor - 1;
        int numWordBreakingCharsSeen = 0;
        while (i >= start) {
            char currentChar = text.charAt(i);
            if (isExplicitChar(currentChar)) {
                // Explicit character must have a word-breaking character before it
                if (i == 0 || isWordBreakingChar(text.charAt(i - 1))) {
                    return currentChar;
                } else {
                    // Otherwise, explicit character is not in a valid position, return null char
                    return (char) 0;
                }
            } else if (isWordBreakingChar(currentChar)) {
                // Do not allow the explicit mention to exceed
                numWordBreakingCharsSeen++;
                if (numWordBreakingCharsSeen == mConfig.MAX_NUM_KEYWORDS) {
                    // No explicit char in maxNumKeywords, so return null char
                    return (char) 0;
                }
            }
            i--;
        }
        return (char) 0;
    }
public char getExplicitChar(final @NonNull CharSequence text, final int cursor) {
        if (cursor < 0 || cursor > text.length()) {
            return (char) 0;
        }
        SpannableStringBuilder ssb = new SpannableStringBuilder(text);
        int start = getSearchStartIndex(ssb, cursor);
        int i = cursor - 1;
        int numWordBreakingCharsSeen = 0;
        while (i >= start) {
            char currentChar = text.charAt(i);
            if (isExplicitChar(currentChar)) {
                // Explicit character must have a word-breaking character before it
                if (i == 0 || isWordBreakingChar(text.charAt(i - 1))) {
                    return currentChar;
                } else {
                    // Otherwise, explicit character is not in a valid position, return null char
                    return (char) 0;
                }
            } else if (isWordBreakingChar(currentChar)) {
                // Do not allow the explicit mention to exceed
                numWordBreakingCharsSeen++;
                if (numWordBreakingCharsSeen == mConfig.MAX_NUM_KEYWORDS) {
                    // No explicit char in maxNumKeywords, so return null char
                    return (char) 0;
                }
            }
            i--;
        }
        return (char) 0;
    }
public char getExplicitChar ( final @ NonNull CharSequence text , final int cursor ) { if ( cursor < 0 || cursor > text . length ( ) ) { return ( char ) 0 ; } SpannableStringBuilder ssb = new SpannableStringBuilder ( text ) ; int start = getSearchStartIndex ( ssb , cursor ) ; int i = cursor - 1 ; int numWordBreakingCharsSeen = 0 ; while ( i >= start ) { char currentChar = text . charAt ( i ) ; if ( isExplicitChar ( currentChar ) ) { // Explicit character must have a word-breaking character before it if ( i == 0 || isWordBreakingChar ( text . charAt ( i - 1 ) ) ) { return currentChar ; } else { // Otherwise, explicit character is not in a valid position, return null char return ( char ) 0 ; } } else if ( isWordBreakingChar ( currentChar ) ) { // Do not allow the explicit mention to exceed numWordBreakingCharsSeen ++ ; if ( numWordBreakingCharsSeen == mConfig . MAX_NUM_KEYWORDS ) { // No explicit char in maxNumKeywords, so return null char return ( char ) 0 ; } } i -- ; } return ( char ) 0 ; }
Returns the explicit character if appropriate (i.e. within the keywords).
If not currently explicit, then returns the null character (i.e. '/0').

@param text   String to get the explicit character from
@param cursor position of the cursor in text

@return the current explicit character or the null character if not currently explicit
Returns the explicit character if appropriate ( i . e . within the keywords ) . If not currently explicit then returns the null character ( i . e . / 0 ) .