String Methods in JAVA
· 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.
· charAt(int index) : Returns the character at the specified index.
· indexOf(String str) : Returns index of the first meetup of a substring.
· lastIndexOf(String str) : Returns index of the last meetup of a substring.
· toUpperCase() : Converts all characters to upper case.
· toLowerCase() : Converts all characters to lower case.
· trim() : Removes whitespace from both ends.
· replace(oldChar, newChar) : Replaces the character with another one.
· isEmpty() : Checks whether the string is empty.
· contains() : Checks if string contains a specific sequence.
· equals() : Checks if two strings have the same sequence of characters.
· equalsIgnoreCase() : Checks equality ignoring case.
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.









