Description :

This method returns the part of the string from the given string for the spcified index and length.

This method does not change the original string value from where they are calling. In order to get the value, the return value should be assigned to some other variable.

Please note that the first character index of the string is "0" and last index is "string.length - 1"

Syntax :

string.substr(StartIndex [,SubStrLength])

Input Parameters :

The begining position of the substring from the given string

SubStrLength (Optional)
The length of the substring starts from the StartIndex. If this is not provided returns complete string from the start position

Return Values :

Returns the part of the string from the given string based on the StartIndex and length.

If StartIndex is greater than or equal to length then returns empty

Test this method :

More Parameters

Test Result :   
Your Code :