Create String From Substring Method

The Create String From Substring method returns a new string. Note the following:

  • This string includes characters that the stringVar variable contains according to the start position and the end position that you specify.

  • The length of this new string is equal to the value of the end argument minus the value of the start argument.

  • It does not return the character that resides at the end position. If you do not specify the end argument, then it returns the characters from the value you specify in the start argument to the end of the string that resides in the stringVar variable.

Format

stringVar.substring(start[, end])

The following table describes the arguments for the Create String From Substring method.

Argument Description

start

An integer that identifies the starting position of the string that this method returns.

end

An integer that identifies the ending position plus 1 of the last character of the string that this method returns.

Example

For an example, see Replace String Method.