[Java] List of methods used when manipulating character strings

1 minute read

I’m Yuhei.

Here is a list of each method used to change or move the contents of the string.


The method used to check if the contents of a string variable are equal.

Unlike the base data type integer comparison, the use of equals differs in that it results in a reference data type string comparison.


This method is used to check if the contents are equal without regard to case.

The equals method also distinguishes between uppercase and lowercase when examining the contents, but with this method, you can check without distinguishing.


Check the length of the string.

The length is in characters, not bytes.

For example, in the following case, the result is 9.

String rong= new String("Good morning");



Checks if the string is empty.

With the length mentioned earlier, the number of characters is checked, while this method checks whether the contents of the string variable are empty.

An “empty state” is a state where there is nothing in the character string. In other words, it is the state of the character string=””.

String str = "";
System.out.println("str method content is empty");
  } else {
    System.out.println("str method content is not empty");

The above code checks if the contents of the variable str is empty and uses an if statement to separate out what the result will be.


Methods for manipulating and examining strings are rarely used by budding people,

Remember, it will be useful when you study later.

that’s all.