Package com.ibm.icu.impl.text
Class RbnfScannerProviderImpl.RbnfLenientScannerImpl
- java.lang.Object
-
- com.ibm.icu.impl.text.RbnfScannerProviderImpl.RbnfLenientScannerImpl
-
- All Implemented Interfaces:
RbnfLenientScanner
- Enclosing class:
- RbnfScannerProviderImpl
private static class RbnfScannerProviderImpl.RbnfLenientScannerImpl extends java.lang.Object implements RbnfLenientScanner
-
-
Field Summary
Fields Modifier and Type Field Description private RuleBasedCollator
collator
-
Constructor Summary
Constructors Modifier Constructor Description private
RbnfLenientScannerImpl(RuleBasedCollator rbc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
allIgnorable(java.lang.String s)
Returns true if a string consists entirely of ignorable characters.int[]
findText(java.lang.String str, java.lang.String key, int startingAt)
Searches a string for another string.int[]
findText2(java.lang.String str, java.lang.String key, int startingAt)
int
prefixLength(java.lang.String str, java.lang.String prefix)
Matches characters in a string against a prefix and return the number of chars that matched, or 0 if no match.
-
-
-
Field Detail
-
collator
private final RuleBasedCollator collator
-
-
Constructor Detail
-
RbnfLenientScannerImpl
private RbnfLenientScannerImpl(RuleBasedCollator rbc)
-
-
Method Detail
-
allIgnorable
public boolean allIgnorable(java.lang.String s)
Description copied from interface:RbnfLenientScanner
Returns true if a string consists entirely of ignorable characters.- Specified by:
allIgnorable
in interfaceRbnfLenientScanner
- Parameters:
s
- The string to test- Returns:
- true if the string is empty or consists entirely of characters that are ignorable.
-
findText
public int[] findText(java.lang.String str, java.lang.String key, int startingAt)
Description copied from interface:RbnfLenientScanner
Searches a string for another string. This might use a Collator to compare strings, or just do a simple match.- Specified by:
findText
in interfaceRbnfLenientScanner
- Parameters:
str
- The string to searchkey
- The string to search "str" forstartingAt
- The index into "str" where the search is to begin- Returns:
- A two-element array of ints. Element 0 is the position of the match, or -1 if there was no match. Element 1 is the number of characters in "str" that matched (which isn't necessarily the same as the length of "key")
-
findText2
public int[] findText2(java.lang.String str, java.lang.String key, int startingAt)
-
prefixLength
public int prefixLength(java.lang.String str, java.lang.String prefix)
Description copied from interface:RbnfLenientScanner
Matches characters in a string against a prefix and return the number of chars that matched, or 0 if no match. Only primary-order differences are significant in determining whether there's a match. This means that the returned value need not be the same as the length of the prefix.- Specified by:
prefixLength
in interfaceRbnfLenientScanner
- Parameters:
str
- The string being testedprefix
- The text we're hoping to see at the beginning of "str"- Returns:
- the number of characters in "str" that were matched
-
-