Java String Methods

 String Methods in java

  1. String.toUpperCase() 
    • returns the String into UpperCase

  2. String.toLowercase() 
    • returns the String into LowerCase

  3. String.charAt(indexValue) 
    • returns the character at given index number

  4. String.replace(oldString/char,newString/char) 
    • returns the String which is replaced with new character/String by old String/character 

  5. String.replaceFirst(oldString,newString) 
    • return the String  which is replace of first occurance of old character/String into new character/String

  6. String.contains(checkString/character) 
    • returns boolean value if the contain the given char/String

  7. String.concat(newString) 
    • returns the concatenation of new String at the end of oldString, we can also use + to concat the Strings

  8. String.equals(checkString)  
    • returns the boolean value by checking the values of 2 strings are exactly matched (case sensitive)

  9. 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)

  10. String.substring(startingIndexNumber) 
    • returns the String from the given index number to last position in a String

  11. 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.

  12. String.valueOf(numericalCharacter) 
    • returns the Value of given character 

  13. String.indexOf(char/String) 
    • returns the position of a given character in a String

  14. String.trim() 
    • returns the String by excluding white space at beginning and ending of the String

  15. String.contentEquals(StringBuffer) 
    • returns boolean value while comparing String to a StringBuffer value

  16. String.length() 
    • returns the length of the String 

  17. String.lastIndexOf(String) 
    • returns the position of the given character in String by checking from last to starting 

  18. String.isEmpty() 
    • returns boolean value if the String is empty

  19. String.split(regrex value/String/char) 
    • returns the array by splitting the array at given character

  20. String.startsWith(char) 
    • returns boolean value by checking the starting character along with given character 

  21. String.endsWith(char) 
    • returns boolean value by checking the ending character along with given character 

  22. String.toCharArray(String) 
    • returns the conversion of String into char array




Comments

Popular posts from this blog

Constructors in java