Sub string( ) 

You can extract a sub string using sub string( ).It has two forms. The first is String sub string(int start index) Here, start index specifies the index at which the sub string will begin. This form returns a copy of the sub string that-begins at start index and runs to tile end of the invoking string. The second form of stringiness ) allows specify both the beginning and ending index of the sub string: ;, ,- String sub string(int  Index Here, startle specifies the beginning index, and end index specifies the stopping point. The string returned contains all the characters from the beginning index, up to, but not including, the ending index. The following program uses sub strength ) to replace all instances of one sub string with another within a string: The output from this program is shown here:

  • This is a test: This is, too.
  • Th was is a test. This is, too.
  • Th was was a test. This is, too.
  • Th was was a test. Thwas is, too.
  • Th was was a test. Thwas was, too.

Concat ( )

You can concatenate two strings using concat( ), shown here: This method creates a new object that contains the invoking string with the contents of str appended to the end. concat( ) performs the same function as +, For example,

[vfb id=1]

Share This