Advertisement
Methods | Description |
---|---|
length() | This method gives us the total length of a String i.e. total number of characters that make a String. |
charAt() | This method gives us a character present at a particular index in a String. |
concat() | This method appends one String at the end of another String |
toUpperCase() | This method returns a String with all the lowercase characters in it converted to uppercase. |
toLowerCase() | 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. |
indexOf(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. |
equalsIgnoreCase() | 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. |
Advertisement
Advertisement
Please check our latest addition
C#, PYTHON and DJANGO
Advertisement