String in java
String is collection of characters like a letter,symbol and numbers.
String methods:
S.No | Methods | Explain |
---|---|---|
charAt() | To return the character for specific index in String. | |
codePointAt() | To return the ascii value for specific index character in the String. | |
codePointBefore() | To return the before the character ascii value. | |
codePointCount() | To return the value for number of ascii code in String.. | |
compareTo() | To compare the two String.It's return the integer value for difference of String. | |
compareToIgnoreCase() | To compare the two String and ignore the case. | |
concat() | To join the two String. | |
contains() | To check the specific character or character sequence contain the String or not | |
contentEquals() | To check the both String equal or not. | |
copyValueOf() | To copy the item from starting index to user defined length in an array. | |
endsWith() | To check the String end with same character sequence or not. | |
equals() | To check the two String equal or not. | |
equalsIgnoreCase() | To check the two String equal or not And ignore the case. | |
format() | To return the String in format. | |
getBytes() | To store the ascii values of all character in String. | |
getChars() | To store the specific starting index to ending index character in Array. | |
hashCode() | To convert the String to Numerical value. | |
indexOf() | return the value of specific character or character sequence starting index of the String. | |
intern() | To check the String with difference reference. | |
isEmpty() | To check the String empty or not. | |
lastIndexOf() | To return the last index of specified character or character sequence in the String. | |
length() | To return the length of the String.. | |
matches() | To heck the both Strings are match or not. | |
offsetByCodePoints() | To returns the index within this String that is offset from the given index by codePointOffset code. | |
regionMatches() | To check the particular character sequence at the two String equal or not. | |
replace() | To replace the specific character or character sequence in String. | |
replaceFirst() | To replace the specific character.But It's replace only for the First occurrences characters or character sequence in a String. | |
replaceAll() | To replace the specific character or character sequence and regex(Regular Expression). | |
split() | To split the String. | |
startsWith() | To check the String start with same character sequence or not. | |
subSequence() | To return the string in specific subsequence. | |
substring() | To return the specific substring character in String. | |
toCharArray() | To convert String all character to char array. | |
toLowerCase() | To convert the String all the uppercase character to lowercase character. | |
toString() | To convert the other datatype or object to String. | |
toUpperCase() | To convert the String all the lowercase character to upperCase character. | |
trim() | To remove the all the white spaces in before and after the String. | |
valueOf() | To convert the any data types value to String. |