private int findFirst ( CharSequence input , int beginIndex , int rewindIndex ) { int first = - 1 ; boolean atomBoundary = true ; for ( int i = beginIndex ; i >= rewindIndex ; i -- ) { char c = input . charAt ( i ) ; if ( localAtomAllowed ( c ) ) { first = i ; atomBoundary = false ; } else if ( c == ' ' ) { if ( atomBoundary ) { break ; } atomBoundary = true ; } else { break ; } } return first ; }
See Local - part in RFC 5321 plus extensions in RFC 6531