substring in java example

substring() StringBuffer Example

java.lang.StringBuffer class comes with many methods to manipulate string. One of the methods is overloaded substring() method used to extract part of the characters present in the buffer. What Java API says about substring() StringBuffer: public synchronized java.lang.String substring(int index1): Returns a string with the characteres of StringBuffer starting from…

substring() String Example

Many methods exist in java.lang.String class used for different string manipulations like checking the availability of a character, to extract a part of a string or to convert a data type to string etc. The present method is substring() String. substring(int) and substring(int, int) extracts part of a string. substring()…