Java String
20 functions
lengthstr.length()Returns the length of the string.
charAtstr.charAt(index)Returns the character at the specified index.
substringstr.substring(begin, end?)Returns a substring from the specified begin index to end index.
indexOfstr.indexOf(str, fromIndex?)Returns the index of the first occurrence of the specified value.
containsstr.contains(sequence)Returns whether this string contains the specified sequence.
startsWithstr.startsWith(prefix, offset?)Tests if this string starts with the specified prefix.
endsWithstr.endsWith(suffix)Tests if this string ends with the specified suffix.
replacestr.replace(old, new)Replaces all occurrences of a character or string.
replaceAllstr.replaceAll(regex, replacement)Replaces all substrings matching the regex.
toUpperCasestr.toUpperCase()Converts all characters to uppercase.
toLowerCasestr.toLowerCase()Converts all characters to lowercase.
trimstr.trim()Removes leading and trailing whitespace.
stripstr.strip()Removes leading and trailing whitespace (Unicode-aware, Java 11+).
splitstr.split(regex, limit?)Splits this string around matches of the given regex.
isEmptystr.isEmpty()Returns true if the string length is 0.
isBlankstr.isBlank()Returns true if the string is empty or contains only whitespace (Java 11+).
formattedstr.formatted(args...)Returns a formatted string using printf-style format specifiers (Java 15+).
valueOfString.valueOf(obj)Returns the string representation of the argument.
formatString.format(format, args...)Returns a formatted string using printf-style format.
joinString.join(delimiter, elements...)Returns a new string joined with the given delimiter.
