slice()

Description :

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

Its looks like same as substring() method but it has few differences
1. If StartIndex is greater than length then it wont swap the parameters.
2. If the StratIndex or length is negative then it will convert as string.length – Length

Syntax :

string.substr(StartIndex [,Length])

Input Parameters :

StartIndex
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 and Length are same then returns empty


Test this method :

More Parameters

Test Result :   
Your Code :