JavaScript substr Method
The Substr method is used to intercept a string by starting position and length and returning a truncated part of the string. The language is as follows:
Password The codes are as follows:
Str_object.substr (start, length)
The parameters say:
The parameters specify that the string to be manipulated (Str_object) start is required. The starting position is calculated from 0, and if the negative is calculated from the end of the string (tests, some browser versions are ineffective), length is optional. Refers to the length of the string to intercept, omitted to the end of the string
Hint: The substr method does not conform to the ECMAscript standard, so it is not recommended.
Substr Method Example
Password The codes are as follows:
<script language= "JavaScript" >
var str = "Www.divcss.online";
document.write (Str.substr (4,5));
</script>
To run the example, output: divcss
Article Source: http://www.divcss.online/divcssbuju/jsrumen/jsjichu/201612/15333.html
JavaScript string-to-image Substr Method Entry example (for intercepting strings)