Java-Extracting Character

Extracting Character The charAt( ) method of StringBuffer class enables us to extract at the specified index position. For example, in the following program, the character at the index position ‘3’ in the string “ABCDE” is ‘D’, the output statement will return the character ‘D’. The setCharAt( ) method of StringBuffer class enables us to … Read more…

Java-Get Substring

Get Substring A substring is a part of another string. For example, the strings “123” and “45” are substrings of the string “12345”. The subString( ) method of the String class enables us to extract the substrings from a string. A substring( ) method of the form substring( int startIndex, int endIndex-1 ) will return a … Read more…