1.substr
SUBSTR (Start,length) is a string that starts at the start position and intercepts length lengths.
var src= "Images/off_1.png";
Alert (SRC.SUBSTR (7,3));
The popup value is: Off
2.substring
SUBSTRING (start,end) represents a string from start to end, including the character of the start position but not the end position.
var src= "Images/off_1.png";
Alert (src.substring (7,10));
The popup value is: Off
3.indexOF
The IndexOf () method returns the position (left-to-right) of the first occurrence of a specified string value in a string. Returns 1 if there is no match, otherwise returns the subscript value of the string where the first occurrence occurs.
var src= "Images/off_1.png";
Alert (Src.indexof (' t '));
Alert (Src.indexof (' I '));
Alert (Src.indexof (' G '));
The popup value is: -1,0,3
4.lastIndexOf
The LastIndexOf () method returns the first character index value of a character or string that appears right-to-left (as opposed to indexof)
var src= "Images/off_1.png";
Alert (Src.lastindexof ('/'));
Alert (Src.lastindexof (' G '));
The popup values are: 6,15
JS in the use of substr,substring,indexof,lastindexof, etc.