Use of String Method
String Methods:
===============
length(); - to find the length of the string
toUpperCase(); - to convert the lowerCase into upperCase
toLowerCase(); - to convert the upperCase into LowerCase
indexOf('char'); - to get a index position of particular letter(first occurred)
lastIndexOf('char'); - to get a index position of particular letter(last occurred)
charAt(index); - to get a particular character from string by using index
equals(stringVariable); - Case sensitive - to compare the 2 string with case sensitive
equalsIgnoreCase(stringVariable); - to compare the 2 string without case sensitive
contains("String") - Case sensitive - to check whether the given value is present or not
replace("String1","String2") - to replace the values
startsWith("Welcome") - to check whether our string starts with the particular value or not
endsWith("class") - to check whether our string ends with the particular value or not
isEmpty() - to check whether our string is empty or not
trim() - to remove the unwanted spaces from the string
Comments
Post a Comment