Friday, 4 March 2016

String Manipulation

String Manipulation
  • The action of the fundamental operations on strings, including their creation, concatenation, the extraction of string segmentsstring matching, their comparison, discovering their length, replacing substrings by other strings, storage, and input/output.
  • some of the string manipulation methods in java are
String creation 
By using the strings class we can create a string.



charArray to String 
By using this we can convert the each letter into a string


isEmpty() & length() 
By using the above method we can get the length of the string.

Different way to use concat() 
By using the concat() method we join the two or more strings.


charAt(), indexOf() & lastIndexOf() 
These methods are used to find the index position of the required character.


compareTo() & compareToIgnoreCase() 
These methods are used to compare the strings.

contentEquals() 
This method is used to check whether the content of the both the strings are similar.

codePointAt(), codePointBefore(), codePointCount() & contains() 
These methods are used to get the code at the specified location.

startsWith() & endsWith() 
These methods are used to check whether the string starts and ends with the given input.

replace(), replaceAll() & replaceFirst() in Java
These methods are used to replace the string in the middle orelse the whole string.

split() & StringArray.length
These methods are used to split (Break) the string into the words.

toUpperCase(), toLowerCase() & toCharArray() 
These methods are used to change the font in upper or lowercase.

No comments:

Post a Comment

: