Java String Methods
String Methods in java
- String.toUpperCase()
- returns the String into UpperCase
- String.toLowercase()
- returns the String into LowerCase
- String.charAt(indexValue)
- returns the character at given index number
- String.replace(oldString/char,newString/char)
- returns the String which is replaced with new character/String by old String/character
- String.replaceFirst(oldString,newString)
- return the String which is replace of first occurance of old character/String into new character/String
- String.contains(checkString/character)
- returns boolean value if the contain the given char/String
- String.concat(newString)
- returns the concatenation of new String at the end of oldString, we can also use + to concat the Strings
- String.equals(checkString)
- returns the boolean value by checking the values of 2 strings are exactly matched (case sensitive)
- String.equalsIgnoreCase(checkString)
- returns the boolean value by checking the values of 2 strings are exactly matched even they are in different Cases (case insensitive)
- String.substring(startingIndexNumber)
- returns the String from the given index number to last position in a String
- String.substring(startingIndexNumber,endingIndexnumber)
- returns the String from given starting index number to given last position value, it doesn't include the last position index character.
- String.valueOf(numericalCharacter)
- returns the Value of given character
- String.indexOf(char/String)
- returns the position of a given character in a String
- String.trim()
- returns the String by excluding white space at beginning and ending of the String
- String.contentEquals(StringBuffer)
- returns boolean value while comparing String to a StringBuffer value
- String.length()
- returns the length of the String
- String.lastIndexOf(String)
- returns the position of the given character in String by checking from last to starting
- String.isEmpty()
- returns boolean value if the String is empty
- String.split(regrex value/String/char)
- returns the array by splitting the array at given character
- String.startsWith(char)
- returns boolean value by checking the starting character along with given character
- String.endsWith(char)
- returns boolean value by checking the ending character along with given character
- String.toCharArray(String)
- returns the conversion of String into char array
Comments
Post a Comment