Advertisement



< Prev
Next >



String Methods




Some methods of String class


In the table below, we have given a short preview about some important methods of String class. You may click on the name of method to get a detailed description with an example.

Methods Description
length()
This method gives us the total length of a String i.e. total number of characters that make a String.

Concat()
This method appends one String at the end of another String

ToUpper()
This method returns a String with all the lowercase characters in it converted to uppercase.

ToLower()
This method returns a String with all the uppercase characters in it converted to lowercase.

Trim()
This method trims/removes all the leading and trailing white space characters in a String.

Substring()
This method returns a part of a String i.e. substring.

StartsWith()
This method returns a substring that starts at an index we specify in this method and it ends at the end of the String.




Advertisement




Methods Description
EndsWith()
This method returns a substring that starts at base index of String and it ends at the index we specify in this method.

Insert(char ch)
This method returns us the index of the first occurrence of a String in a String.

LastIndexOf()
This method returns us the index of the last occurrence of a particular character in a String.

Replace()
This method replaces all the occurrences of a particular character with a new character in the String.

Equals()
This method checks for the equality of values in the two String objects.

Split()
This method checks for the equality of values in the two String objects, ignoring the case(lowercase/uppercase) in which character are present in a String.

ToString()
This method is used when we need String representation of the value of an object.

Remove()
This method is used when we need String representation of the value of an object.

Contains()
This method is used when we need String representation of the value of an object.

Join()
This method is used when we need String representation of the value of an object.




Please share this article -





< Prev
Next >
< C# Immutable String
C# String Comparison with == >



Advertisement

Please Subscribe

Please subscribe to our social media channels for daily updates.


Decodejava Facebook Page  DecodeJava Twitter Page Decodejava Google+ Page




Advertisement



Notifications



Please check our latest addition

C#, PYTHON and DJANGO


Advertisement