LocalizedTextUtils
Package: velox.gui.utils.localization
Type: Class
Inheritance: java.lang.Object รขโ โ LocalizedTextUtils
Descriptionโ
Utility class for work with Unicode strings.
Contains methods for work with the user-perceived characters instead of Unicode code points.
For more info see UAX #29: Unicode Text Segmentation#Grapheme Cluster Boundaries
Constructorsโ
LocalizedTextUtilsโ
public LocalizedTextUtils()
Methodsโ
getCharCountโ
public static int getCharCount(String text, com.ibm.icu.util.ULocale locale)
Returns the length of the given string.
The length is equal to the number of user-perceived characters in the string for the given locale.
Note: this method is computation-heavy, so it is not recommended to use in frequently called code.
Consider creation of own BreakIterator through BreakIterator.getCharacterInstance(ULocale locale) method in this case
Parameters:
text- which length need to knowlocale- use the character boundary rules for this locale
Returns: the length of the sequence of characters represented by text object.
getCharCountโ
public static int getCharCount(String text)
Returns the length of the given string on the current Bookmap locale.
The length is equal to the number of user-perceived characters in the string for the current Bookmap locale.
Note: this method is computation-heavy, so it is not recommended to use in frequently called code.
Consider creation of own BreakIterator through BreakIterator.getCharacterInstance(ULocale locale) method in this case
Parameters:
text- which length need to know
Returns: the length of the sequence of characters represented by text object.
getCharAtโ
public static String getCharAt(String text, int position, com.ibm.icu.util.ULocale locale)
Returns the user-perceived character at the given position of the text.
Note: this method is computation-heavy, so it is not recommended to use in frequently called code.
Consider creation of own BreakIterator through BreakIterator.getCharacterInstance(ULocale locale) method in this case
Parameters:
text- from which need to get characterposition- the index to the user-perceived character in the textlocale- use the character boundary rules for this locale
Returns: the user-perceived character character at the given position
getCharAtโ
public static String getCharAt(String text, int position)
Returns the user-perceived character at the given position of the text.
Uses the current Bookmap locale character boundary rules.
Note: this method is computation-heavy, so it is not recommended to use in frequently called code.
Consider creation of own BreakIterator through BreakIterator.getCharacterInstance(ULocale locale) method in this case
Parameters:
text- from which need to get characterposition- the index to the user-perceived character in the text
Returns: the user-perceived character character at the given position
toUpperCaseโ
public static String toUpperCase(String text, com.ibm.icu.util.ULocale locale)
Same as String.toUpperCase(Locale), but support wider number of languages
Parameters:
text- that needs to cast to the upper caselocale- use the case transformation rules for this locale
Returns: the String, converted to uppercase
toUpperCaseโ
public static String toUpperCase(String text)
Same as String.toUpperCase(Locale), but support wider number of languages.
Uses the current Bookmap locale case transformation rules
Parameters:
text- that needs to cast to the upper case
Returns: the String, converted to uppercase
toLowerCaseโ
public static String toLowerCase(String text, com.ibm.icu.util.ULocale locale)
Same as String.toLowerCase(Locale), but support wider number of languages
Parameters:
text- that needs to cast to the lower caselocale- use the case transformation rules for this locale
Returns: the String, converted to lowercase
toLowerCaseโ
public static String toLowerCase(String text)
Same as String.toLowerCase(Locale), but support wider number of languages
Uses the current Bookmap locale case transformation rules
Parameters:
text- that needs to cast to the lower case
Returns: the String, converted to lowercase