The
substring of StringBuffer is used to obtain the substring from the StringBuffer. It is similar to substring method in Strings .
There are two forms of
substring . The first form is :String substring(int startIndex, int endIndex); This will extract a substring of a StringBuffer from startIndex till the endIndex but won't include the character at endIndex .
The otherform of substring is:String substring(int startIndex); This form will extract substring from startIndex till the end of the buffer.Here is the example program on both forms of substring .
SubstringExample String Buffer CODE class PrintSubstring OUTPUT Sound DESCRIPTION This program shows the two forms of THINGS TO TRY
Dependent Topics :
|