0% found this document useful (0 votes)
4 views2 pages

Java String Character Functions

The document provides a comprehensive list of methods available in the Java String and Character classes. It details various string manipulation functions such as substring extraction, character replacement, and case conversion, as well as character checks for digit, letter, and whitespace. Additionally, it highlights newer methods introduced in Java 11 for string handling.

Uploaded by

trexakart
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Java String Character Functions

The document provides a comprehensive list of methods available in the Java String and Character classes. It details various string manipulation functions such as substring extraction, character replacement, and case conversion, as well as character checks for digit, letter, and whitespace. Additionally, it highlights newer methods introduced in Java 11 for string handling.

Uploaded by

trexakart
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Java String and Character Functions

String Class Methods (java.lang.String)

charAt(int index) - Returns character at given index

length() - Returns length of string

substring(int beginIndex) - Returns substring from index

substring(int beginIndex, int endIndex) - Returns substring between indices

indexOf(char) - Returns first occurrence of character

indexOf(String) - Returns first occurrence of substring

lastIndexOf(char) - Last occurrence of character

equals(Object) - Compares content

equalsIgnoreCase(String) - Ignores case

compareTo(String) - Lexicographic compare

compareToIgnoreCase(String) - Compare ignoring case

contains(CharSequence) - Checks if substring exists

startsWith(String) - Checks prefix

endsWith(String) - Checks suffix

isEmpty() - Checks if string is empty

isBlank() - Checks if string is empty or only whitespace

toLowerCase() - Converts to lowercase

toUpperCase() - Converts to uppercase

trim() - Removes leading/trailing spaces

replace(char, char) - Replaces character

replaceAll(String regex, String replacement) - Replaces all matching regex

replaceFirst(String regex, String replacement) - Replaces first match

split(String regex) - Splits string into array

toCharArray() - Converts to char array

valueOf(int) - Converts int to String

join(CharSequence delimiter, elements...) - Joins strings with delimiter

format(String format, args...) - Formats string

intern() - Returns canonical representation

repeat(int count) - Repeats string n times (Java 11+)

strip() - Removes leading/trailing whitespaces (Java 11+)


stripLeading() - Removes leading spaces (Java 11+)

stripTrailing() - Removes trailing spaces (Java 11+)

Character Class Methods (java.lang.Character)

isDigit(char) - Checks if digit

isLetter(char) - Checks if letter

isLetterOrDigit(char) - Letter or digit

isUpperCase(char) - Checks if uppercase

isLowerCase(char) - Checks if lowercase

isWhitespace(char) - Checks if whitespace

isAlphabetic(int codePoint) - Checks if alphabetic character

toUpperCase(char) - Converts to uppercase

toLowerCase(char) - Converts to lowercase

getNumericValue(char) - Returns int value of digit

toString(char) - Converts char to String

You might also like