private String pickLowerOrUpper(String inputMode){
  int pos=getCursorPosition() - 1;
  if (pendingCommit) {
    pos--;
  }
  String text=getText();
  if (pos >= text.length()) {
    pos=text.length() - 1;
  }
  while (pos > -1) {
    if (text.charAt(pos) == '.') {
      return inputMode.toUpperCase();
    }
    if (text.charAt(pos) != ' ') {
      return inputMode.toLowerCase();
    }
    pos--;
  }
  return inputMode.toUpperCase();
}

private String pickLowerOrUpper ( String inputMode ) { int pos = getCursorPosition ( ) - 1 ; if ( pendingCommit ) { pos -- ; } String text = getText ( ) ; if ( pos >= text . length ( ) ) { pos = text . length ( ) - 1 ; } while ( pos > - 1 ) { if ( text . charAt ( pos ) == '.' ) { return inputMode . toUpperCase ( ) ; } if ( text . charAt ( pos ) != ' ' ) { return inputMode . toLowerCase ( ) ; } pos -- ; } return inputMode . toUpperCase ( ) ; }
used for the case of first sentence character should be upper case
