Sitemap
Dhanusha Hasheel

Dhanusha Hasheel

I am a software engineering undergraduate who shares practical IT and software knowledge through blogs, helping others learn and solve real-world challenges.

String Methods in JAVA

3 min readNov 6, 2025
Press enter or click to view image in full size
-Most Common String Methods-

· Java provides a variety of built-in features for the String class to help us implement and analyze strings effectively and efficiently.

Get Dhanusha Hasheel’s stories in your inbox

Join Medium for free to get updates from this writer.

· The following string methods are some the methods that use mainly in our java projects.

Most common string methods

· length() : return the length of the string.

length()

· charAt(int index) : Returns the character at the specified index.

charAt()

· indexOf(String str) : Returns index of the first meetup of a substring.

indexOf()

· lastIndexOf(String str) : Returns index of the last meetup of a substring.

lastIndexOf()

· toUpperCase() : Converts all characters to upper case.

toUpperCase()

· toLowerCase() : Converts all characters to lower case.

toLowerCase()

· trim() : Removes whitespace from both ends.

trim()

· replace(oldChar, newChar) : Replaces the character with another one.

Press enter or click to view image in full size
replace()

· isEmpty() : Checks whether the string is empty.

isEmpty()

· contains() : Checks if string contains a specific sequence.

contains()

· equals() : Checks if two strings have the same sequence of characters.

equals()

· equalsIgnoreCase() : Checks equality ignoring case.

equalsIgnoreCase()

SUMMARY

Ø These JAVA string methods cover the most common operations you’ll need when working with Java environment.

Ø The string class in Java is very critical because it provides efficient handling of data.

Ø Using these methods helps clean, efficient implementation of textual data in software engineering projects.

--

--

I am a software engineering undergraduate who shares practical IT and software knowledge through blogs, helping others learn and solve real-world challenges.

See more from me