Package opennlp.tools.util
Class StringUtil
- java.lang.Object
-
- opennlp.tools.util.StringUtil
-
public class StringUtil extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description StringUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isEmpty(java.lang.CharSequence theString)
Returns true ifCharSequence.length()
is 0 or null.static boolean
isWhitespace(char charCode)
Determines if the specified character is a whitespace.static boolean
isWhitespace(int charCode)
Determines if the specified character is a whitespace.static java.lang.String
toLowerCase(java.lang.CharSequence string)
Converts to lower case independent of the current locale viaCharacter.toLowerCase(char)
which uses mapping information from the UnicodeData file.static java.lang.String
toUpperCase(java.lang.CharSequence string)
Converts to upper case independent of the current locale viaCharacter.toUpperCase(char)
which uses mapping information from the UnicodeData file.
-
-
-
Method Detail
-
isWhitespace
public static boolean isWhitespace(char charCode)
Determines if the specified character is a whitespace. A character is considered a whitespace when one of the following conditions is meet:- Its a
Character.isWhitespace(int)
whitespace. - Its a part of the Unicode Zs category (
Character.SPACE_SEPARATOR
).
Character.isWhitespace(int)
does not include no-break spaces. In OpenNLP no-break spaces are also considered as white spaces.- Parameters:
charCode
-- Returns:
- true if white space otherwise false
- Its a
-
isWhitespace
public static boolean isWhitespace(int charCode)
Determines if the specified character is a whitespace. A character is considered a whitespace when one of the following conditions is meet:- Its a
Character.isWhitespace(int)
whitespace. - Its a part of the Unicode Zs category (
Character.SPACE_SEPARATOR
).
Character.isWhitespace(int)
does not include no-break spaces. In OpenNLP no-break spaces are also considered as white spaces.- Parameters:
charCode
-- Returns:
- true if white space otherwise false
- Its a
-
toLowerCase
public static java.lang.String toLowerCase(java.lang.CharSequence string)
Converts to lower case independent of the current locale viaCharacter.toLowerCase(char)
which uses mapping information from the UnicodeData file.- Parameters:
string
-- Returns:
- lower cased String
-
toUpperCase
public static java.lang.String toUpperCase(java.lang.CharSequence string)
Converts to upper case independent of the current locale viaCharacter.toUpperCase(char)
which uses mapping information from the UnicodeData file.- Parameters:
string
-- Returns:
- upper cased String
-
isEmpty
public static boolean isEmpty(java.lang.CharSequence theString)
Returns true ifCharSequence.length()
is 0 or null.- Returns:
- true if
CharSequence.length()
is 0, otherwise false - Since:
- 1.5.1
-
-