/** Creates a new {@link TextPattern} object that can be used to search for the given pattern. * * @param pattern the constant pattern to search for. * @param flags a bit mask that may include {@link #CASE_INSENSITIVE} and {@link #UNICODE_CASE}. */ public TextPattern( final CharSequence pattern, final int flags ) { this.pattern = new char[ pattern.length() ]; MutableString.getChars( pattern, 0, this.pattern.length, this.pattern, 0 ); caseSensitive = ( flags & CASE_INSENSITIVE ) == 0; asciiCase = ( flags & UNICODE_CASE ) == 0; if ( ! caseSensitive ) { int i = this.pattern.length; if ( asciiCase ) while( i-- != 0 ) this.pattern[ i ] = asciiToLowerCase( this.pattern[ i ] ); else while( i-- != 0 ) this.pattern[ i ] = unicodeToLowerCase( this.pattern[ i ] ); } compile(); }
/** Creates a new {@link TextPattern} object that can be used to search for the given pattern. * * @param pattern the constant pattern to search for. * @param flags a bit mask that may include {@link #CASE_INSENSITIVE} and {@link #UNICODE_CASE}. */ public TextPattern(final CharSequence pattern, final int flags) { this.pattern = new char[pattern.length()]; MutableString.getChars(pattern, 0, this.pattern.length, this.pattern, 0); caseSensitive = (flags & CASE_INSENSITIVE) == 0; asciiCase = (flags & UNICODE_CASE) == 0; if (! caseSensitive) { int i = this.pattern.length; if (asciiCase) while(i-- != 0) this.pattern[i] = asciiToLowerCase(this.pattern[i]); else while(i-- != 0) this.pattern[i] = unicodeToLowerCase(this.pattern[i]); } compile(); }
/** Creates a new {@link TextPattern} object that can be used to search for the given pattern. * * @param pattern the constant pattern to search for. * @param flags a bit mask that may include {@link #CASE_INSENSITIVE} and {@link #UNICODE_CASE}. */ public TextPattern( final CharSequence pattern, final int flags ) { this.pattern = new char[ pattern.length() ]; MutableString.getChars( pattern, 0, this.pattern.length, this.pattern, 0 ); caseSensitive = ( flags & CASE_INSENSITIVE ) == 0; asciiCase = ( flags & UNICODE_CASE ) == 0; if ( ! caseSensitive ) { int i = this.pattern.length; if ( asciiCase ) while( i-- != 0 ) this.pattern[ i ] = asciiToLowerCase( this.pattern[ i ] ); else while( i-- != 0 ) this.pattern[ i ] = unicodeToLowerCase( this.pattern[ i ] ); } compile(); }