Various methods of Java String class

Method related to string inspection

Method operation Argument type Return type
equals Check if the contents are equal String boolean
equalsIgnoreCase Check if the content is equal, ignoring case String boolean
length Check the length of the string String int
isEmpty Check if it is an empty string String int

Methods for string search

Method operation Argument type Return type
contains Find out if it contains a string String boolean
startsWith Find out if it starts with the specified string String boolean
endsWith Checks if it ends with the specified string String boolean
indexOf Find out where the specified character or string first appears String int
lastIndexOf Search from the back for the specified character or string to find out where it first appears String int

Method related to string clipping

Method operation Argument type Return type
charAt Cut out one character at the specified position int String
startsWith Checks if it starts with the specified string String boolean
endsWith Checks if it ends with the specified string String boolean
indexOf Find out where the specified character or string first appears String int
lastIndexOf Search from the back for the specified character or string to find out where it first appears String int

Methods for string conversion

Method operation Argument type Return type
toLowerCase Convert uppercase to lowercase String String
toUpperCase Convert uppercase to lowercase String
trim Remove leading and trailing whitespace String
replace Replace with the specified string String,String String
reverse Invert the specified string String

References

Java introductory practice that you can understand clearly

Recommended Posts

Various methods of Java String class
Various methods of the String class
Java class methods
String class methods
About Java String class
Java inflexible String class substring
[Java] Comparator of Collection class
Summary of Java Math class
About Java class variables class methods
[Java] Handling of character strings (String class and StringBuilder class)
[Java] Speed comparison of string concatenation
Java methods
Java string
Java methods
How to use class methods [Java]
[Java] Correct comparison of String type
[Introduction to Java] Handling of character strings (String class, StringBuilder class)
I tried to summarize the methods of Java String and StringBuilder
[Java] Data type / string class cheat sheet
[Java] Inheritance and structure of HttpServlet class
Try various Java Stream API methods (now)
[Java] Comparison of String type character strings
[Java] Class inheritance
java Scanner class
Java HashMap class
[Java] String padding
java (abstract class)
[Java] Nested class
Java anonymous class
Java string processing
About Java class
[Java] How to get to the front of a specific string using the String class
[java] abstract class
[Java] Object class
Split string (Java)
Java local class
[Java] Overview of Java
[Java] Personal summary of classes and methods (basic)
[Java] Get the length of the surrogate pair string
[Java] The confusing part of String and StringBuilder
[Note] Java: Measures the speed of string concatenation
JAVA: Realizes generation and scanning of various barcodes
A quick review of Java learned in class
We have collected various implementation methods of singleton.
First touch of the Files class (or Java 8)
Java String class methods that are a little useful to know but don't know
[Java] Sort ArrayList with elements of your own class
Expired collection of java
[Java] How to use compareTo method of Date class
Use of Date class
Predicted Features of Java
[Java] Significance of serialVersionUID
[Java] Meaning of Public static void main (String [] args)
About Java StringBuilder class
A quick review of Java learned in class part4
NIO.2 review of java
Review of java Shilber
[Java] About Singleton Class
[Java] String comparison and && and ||
Java string multiple replacement
Browse class objects in Kotlin (instead of Java class name.class)