I encountered the problem of intercepting strings this morning. I knew before that there is a difference between substr and substring, but I don’t know what the difference is.
Now I mark it
String.substr(N1,N2). This is what we commonly use to specify from Intercept the string of specified length (N2) at the position (N1);
String.substring(N1,N2) This is our commonly used string from the specified position (N1) to the specified position (N2);
for example:
alert("abcdefg".substr(2,5)) It displays "cdefg"
alert("abcdefg".substring(2,5)) displays "efg"