private static boolean matchInf ( byte [ ] str , byte firstchar , int start , int end ) { final int len = end - start ; // The wonders of unicode. The infinity symbol \u221E is three bytes: if ( len == 3 && firstchar == - 0x1E && str [ start + 1 ] == - 0x78 && str [ start + 2 ] == - 0x62 ) { return true ; } if ( ( len != 3 && len != INFINITY_LENGTH ) // || ( firstchar != ' ' && firstchar != ' ' ) ) { return false ; } for ( int i = 1 , j = INFINITY_LENGTH + 1 ; i < INFINITY_LENGTH ; i ++ , j ++ ) { final byte c = str [ start + i ] ; if ( c != INFINITY_PATTERN [ i ] && c != INFINITY_PATTERN [ j ] ) { return false ; } if ( i == 2 && len == 3 ) { return true ; } } return true ; }
Match inf infinity in a number of different capitalizations .