Package com.luciad.util
Class TLcdStringUtil
java.lang.Object
com.luciad.util.TLcdStringUtil
This class provides convenience methods for String tests and operations.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
capitalizeFirstCharacter
(String aString) Returns a string containing all characters of the given string, but the first character will be uppercase.static boolean
containsIgnoreCase
(String aString, String aSubstring) Returns whether the given string contains the given substring, ignoring the case.static boolean
endsWithIgnoreCase
(String aString, String aSuffix) Returns whether the given string starts with the given prefix, ignoring the case.static int
indexOfIgnoreCase
(String aString, String aSubstring) Returns the index within the given string of the first occurrence of the specified substring, ignoring the case.static String
replacePrefixPreserveCase
(String aString, int aPrefixLength, String aNewPrefix) Returns the given string, with its prefix replaced by a new prefix, preserving the case of the prefix.static String
replaceSuffixPreserveCase
(String aString, int aSuffixLength, String aNewSuffix) Returns the given string, with its suffix replaced by a new suffix, preserving the case of the suffix.static boolean
startsWithIgnoreCase
(String aString, String aPrefix) Returns whether the given string starts with the given prefix, ignoring the case.static boolean
startsWithIgnoreCase
(String aString, String aPrefix, int aStringOffset) Returns whether the given string starts with the given prefix, beginning at a specified index, and ignoring the case.static String
toMatchingCase
(String aString, String aCaseString) Returns the given string, changing its case to match the case of the given case string.
-
Constructor Details
-
TLcdStringUtil
public TLcdStringUtil()
-
-
Method Details
-
startsWithIgnoreCase
Returns whether the given string starts with the given prefix, ignoring the case.- See Also:
-
startsWithIgnoreCase
Returns whether the given string starts with the given prefix, beginning at a specified index, and ignoring the case.- See Also:
-
endsWithIgnoreCase
Returns whether the given string starts with the given prefix, ignoring the case.- See Also:
-
containsIgnoreCase
Returns whether the given string contains the given substring, ignoring the case.- Parameters:
aString
- the string that potentially containsaSubstring
aSubstring
- the substring to look for- Returns:
- true if this string contains
aSubstring
, false otherwise - Since:
- 2021.1
- See Also:
-
indexOfIgnoreCase
Returns the index within the given string of the first occurrence of the specified substring, ignoring the case.- Parameters:
aString
- the string that potentially containsaSubstring
aSubstring
- the substring to look for- Returns:
- the index of the first occurrence of the specified substring,
or
-1
if there is no such occurrence. - Since:
- 2021.1
- See Also:
-
replacePrefixPreserveCase
public static String replacePrefixPreserveCase(String aString, int aPrefixLength, String aNewPrefix) Returns the given string, with its prefix replaced by a new prefix, preserving the case of the prefix. The case can be all lowercase, all uppercase, or unchanged. -
replaceSuffixPreserveCase
public static String replaceSuffixPreserveCase(String aString, int aSuffixLength, String aNewSuffix) Returns the given string, with its suffix replaced by a new suffix, preserving the case of the suffix. The case can be all lowercase, all uppercase, or unchanged. -
toMatchingCase
Returns the given string, changing its case to match the case of the given case string. The case can be all lowercase, all uppercase, or unchanged. -
capitalizeFirstCharacter
Returns a string containing all characters of the given string, but the first character will be uppercase.- Parameters:
aString
- the input string- Returns:
- a copy of the given string, with the first character capitalized
-