Description :

This method returns the part of the string from the given string for the spcified indexes.

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 [,Length])

Input Parameters :

The begining position of the substring from the given string

Length (Optional)
The end position of the substring starts from the orginal string first character. 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 length value then parameters value will be swapped.

If StartIndex is less than 0 then StartIndex will become 0.

If StartIndex and Length are same then returns empty

Test this method :

More Parameters

Test Result :   
Your Code :