Package velox.gui.utils.localization
Class LocalizedTextUtils
java.lang.Object
velox.gui.utils.localization.LocalizedTextUtils
Utility class for work with Unicode strings.
Contains methods for work with the user-perceived characters insead of Unicode code points.
For more info see UAX #29: Unicode Text Segmentation#Grapheme Cluster Boundaries
Contains methods for work with the user-perceived characters insead of Unicode code points.
For more info see UAX #29: Unicode Text Segmentation#Grapheme Cluster Boundaries
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringReturns 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.static StringReturns the user-perceived character at the given position of the text.static intgetCharCount(String text) Returns the length of the given string on the current Bookmap locale.static intgetCharCount(String text, com.ibm.icu.util.ULocale locale) Returns the length of the given string.static StringtoLowerCase(String text) Same asString.toLowerCase(Locale), but support wider number of languages Uses the current Bookmap locale case transformation rulesstatic StringtoLowerCase(String text, com.ibm.icu.util.ULocale locale) Same asString.toLowerCase(Locale), but support wider number of languagesstatic StringtoUpperCase(String text) Same asString.toUpperCase(Locale), but support wider number of languages.static StringtoUpperCase(String text, com.ibm.icu.util.ULocale locale) Same asString.toUpperCase(Locale), but support wider number of languages
-
Constructor Details
-
LocalizedTextUtils
public LocalizedTextUtils()
-
-
Method Details
-
getCharCount
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 ownBreakIteratorthroughBreakIterator.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
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 ownBreakIteratorthroughBreakIterator.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
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 ownBreakIteratorthroughBreakIterator.getCharacterInstance(ULocale locale)method in this case- Parameters:
text- from which neet 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
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 ownBreakIteratorthroughBreakIterator.getCharacterInstance(ULocale locale)method in this case- Parameters:
text- from which neet to get characterposition- the index to the user-perceived character in the text- Returns:
- the user-perceived character character at the given position
-
toUpperCase
Same asString.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
Same asString.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
Same asString.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
Same asString.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
-