Package com.oracle.bmc.util.internal
Enum StringUtils
- java.lang.Object
- 
- java.lang.Enum<StringUtils>
- 
- com.oracle.bmc.util.internal.StringUtils
 
 
- 
- All Implemented Interfaces:
- Serializable,- Comparable<StringUtils>
 
 public enum StringUtils extends Enum<StringUtils> String manipulation utilities.
- 
- 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancontains(String s, String searchStr)Return true if the string contains the search string, or false if either is null.static booleancontainsIgnoreCase(String s, String searchStr)Return true if the string contains the search string, ignoring case, or false if either is null.static booleanequalsIgnoreCase(String s1, String s2)Null-safe case-insensitive equals.static booleanisAllBlank(String... strings)Returns true if all of the strings passed in are blank, as determined by isBlank.static booleanisAnyBlank(String... strings)Returns true if any of the strings passed in are blank, as determined by isBlank.static booleanisBlank(String s)Return true if this string is either null or just whitespace.static booleanisEmpty(String s)Returns true if the string is empty.static booleanisNoneBlank(String... strings)Returns true if none of the strings passed in are blank, as determined by isBlank.static booleanisNotBlank(String s)Return true if this string is not null and not just whitespace.static booleanisNotEmpty(String s)Returns true if the string is not empty.static Stringjoin(Collection<?> objects, String delimiter)Join the collection of objects to a string.static Stringleft(String s, int length)Return the first length characters of the string.static intlength(String s)Return the length of the string, or 0 if the string is null.static Stringrandom(int length, String allowed)Returns a string of the requested length, made up of characters from the allowed string.static StringrandomAlphabetic(int length)Returns a string of random alphabetic characters of the requested length.static StringrandomAlphabetic(int minLengthInclusive, int maxLengthExclusive)Returns a string of random alphabetic characters at least minLengthInclusive characters and less than maxLengthExclusive characters long.static StringrandomPrint(int length)Returns a string of random printable characters of the requested length.static StringrandomPrint(int minLengthInclusive, int maxLengthExclusive)Returns a string of random printable characters at least minLengthInclusive characters and less than maxLengthExclusive characters long.static Stringrepeat(String substring, int count)Repeat the substring count times.static Stringreplace(String template, Map<String,String> replacements, String prefix, String suffix)Replace the placeholders in the template with the values in the replacement mapping.static StringupperCase(String s)Returns the string in uppercase, or null if it was nullstatic StringUtilsvalueOf(String name)Returns the enum constant of this type with the specified name.static StringUtils[]values()Returns an array containing the constants of this enum type, in the order they are declared.
 
- 
- 
- 
Method Detail- 
valuespublic static StringUtils[] values() Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (StringUtils c : StringUtils.values()) System.out.println(c); - Returns:
- an array containing the constants of this enum type, in the order they are declared
 
 - 
valueOfpublic static StringUtils valueOf(String name) Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
- name- the name of the enum constant to be returned.
- Returns:
- the enum constant with the specified name
- Throws:
- IllegalArgumentException- if this enum type has no constant with the specified name
- NullPointerException- if the argument is null
 
 - 
isBlankpublic static boolean isBlank(String s) Return true if this string is either null or just whitespace.- Parameters:
- s- the string
- Returns:
- true if this string is either null or just whitespace.
 
 - 
isNotBlankpublic static boolean isNotBlank(String s) Return true if this string is not null and not just whitespace.- Parameters:
- s- the string
- Returns:
- true if this string is not null and not just whitespace.
 
 - 
joinpublic static String join(Collection<?> objects, String delimiter) Join the collection of objects to a string.Objects that are null are represented by the empty string. - Parameters:
- objects- collection of objects
- delimiter- delimiter between the objects
- Returns:
- joined string
 
 - 
replacepublic static String replace(String template, Map<String,String> replacements, String prefix, String suffix) Replace the placeholders in the template with the values in the replacement mapping.- Parameters:
- template- template string
- replacements- map from key to replacement value
- prefix- prefix of the placeholder
- suffix- suffix of the placeholder
- Returns:
- replaced string
 
 - 
randomPrintpublic static String randomPrint(int minLengthInclusive, int maxLengthExclusive) Returns a string of random printable characters at least minLengthInclusive characters and less than maxLengthExclusive characters long.The characters have ASCII codes ranging from 32 to 125 (both inclusive) and include spaces. - Parameters:
- minLengthInclusive- minimum length (inclusive)
- maxLengthExclusive- maximum length (exclusive)
- Returns:
- the random string
 
 - 
randomPrintpublic static String randomPrint(int length) Returns a string of random printable characters of the requested length.The characters have ASCII codes ranging from 32 to 125 (both inclusive) and include spaces. - Parameters:
- length- length in characters
- Returns:
- the random string
 
 - 
randomAlphabeticpublic static String randomAlphabetic(int minLengthInclusive, int maxLengthExclusive) Returns a string of random alphabetic characters at least minLengthInclusive characters and less than maxLengthExclusive characters long.The characters range from 'A' - 'Z' or from 'a' - 'z' (all inclusive). - Parameters:
- minLengthInclusive- minimum length (inclusive)
- maxLengthExclusive- maximum length (exclusive)
- Returns:
- the random string
 
 - 
randomAlphabeticpublic static String randomAlphabetic(int length) Returns a string of random alphabetic characters of the requested length.The characters range from 'A' - 'Z' or from 'a' - 'z' (all inclusive). - Parameters:
- length- length in characters
- Returns:
- the random string
 
 - 
randompublic static String random(int length, String allowed) Returns a string of the requested length, made up of characters from the allowed string.- Parameters:
- length- length in characters
- allowed- string with allowed characters
- Returns:
- the random string
 
 - 
isAnyBlankpublic static boolean isAnyBlank(String... strings) Returns true if any of the strings passed in are blank, as determined by isBlank.- Parameters:
- strings- strings to check
- Returns:
- true if any of the strings are blank
 
 - 
isNoneBlankpublic static boolean isNoneBlank(String... strings) Returns true if none of the strings passed in are blank, as determined by isBlank.- Parameters:
- strings- strings to check
- Returns:
- true if none of the strings are blank
 
 - 
isAllBlankpublic static boolean isAllBlank(String... strings) Returns true if all of the strings passed in are blank, as determined by isBlank.- Parameters:
- strings- strings to check
- Returns:
- true if all of the strings are blank
 
 - 
isNotEmptypublic static boolean isNotEmpty(String s) Returns true if the string is not empty.- Parameters:
- s- string to check
- Returns:
- true if not empty
 
 - 
isEmptypublic static boolean isEmpty(String s) Returns true if the string is empty.- Parameters:
- s- string to check
- Returns:
- true if empty
 
 - 
upperCasepublic static String upperCase(String s) Returns the string in uppercase, or null if it was null- Parameters:
- s- string to convert to uppercase
- Returns:
- string in uppercase, or null if it was null
 
 - 
leftpublic static String left(String s, int length) Return the first length characters of the string.- Parameters:
- s- string
- length- number of characters
- Returns:
- first s
 
 - 
lengthpublic static int length(String s) Return the length of the string, or 0 if the string is null.- Parameters:
- s- string
- Returns:
- length of string or 0 if string is null
 
 - 
containsIgnoreCasepublic static boolean containsIgnoreCase(String s, String searchStr) Return true if the string contains the search string, ignoring case, or false if either is null.- Parameters:
- s- string
- searchStr- substring to search for
- Returns:
- true if the string contains the search string, or false if either is null
 
 - 
equalsIgnoreCasepublic static boolean equalsIgnoreCase(String s1, String s2) Null-safe case-insensitive equals.- Parameters:
- s1- first string
- s2- second string
- Returns:
- true if equals, ignoring case
 
 - 
containspublic static boolean contains(String s, String searchStr) Return true if the string contains the search string, or false if either is null.- Parameters:
- s- string
- searchStr- substring to search for
- Returns:
- true if the string contains the search string, or false if either is null
 
 
- 
 
-