Saturday, 24 August 2013

Java - String Buffer replace() Method

Description:

This method replaces the characters in a substring of this StringBuffer with characters in the specified String.
The substring begins at the specified start and extends to the character at index end - 1 or to the end of the StringBuffer if no such character exists. First the characters in the substring are removed and then the specified String is inserted at start.

Syntax:

Here is the syntax of this method:
public StringBuffer replace(int start, int end, String str)

Parameters:

Here is the detail of parameters:
  • start -- The beginning index, inclusive.
  • end -- The ending index, exclusive.
  • str -- String that will replace previous contents.

Return Value:

  • This method Returns the modified SringBuffer object.

No comments:

Post a Comment