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
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 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
Try various Java Stream API methods (now)
Java, class field methods starting from beginners
java Scanner class
Java HashMap class
[Java] String padding
java (abstract 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
Split string (Java)
Java local class
[Java] Overview of Java
[Java] Personal summary of classes and methods (basic)
[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)
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)
java --Unification of comments
Java inner class review
[java.io] Summary of Java string input (InputStream, Reader, Scanner)
Java class type field
History of Java annotation
[Note] Java: String search
[Note] Java: String survey
java (merits of polymorphism)
Java programming (class method)
[Java] About Objects.equals () and Review of String comparisons (== and equals)
Various threads in java
A quick review of Java learned in class part3
A quick review of Java learned in class part2
Use of Abstract Class and Interface properly in Java
NIO review of java
Java programming (class structure)
Java random, various processing