substr () method can be extracted in the string specified number of characters from the start subscript.

stringObject. Substr (start, length); Must start, the length is optional.
var s="abcdefg";

s.s ubstring (1, 4)//Returns "BCD"
s.s lice (1, 4)//Returns "BCD"
s.s ubstr (1, 4)//Returns "bcde"

s.s ubstring (2, 3)//Returns "ab" is actually the s.s ubstring (0, 2) the parameters of the smaller will be in front of the
s.s lice (2, 3)//Returns "CD" is actually the s.s lice (2, 4)
s.s ubstr (2, 3)//Returns "cdef" is actually the s.s lice (2, 4)

you might be interested in the article:

  • js substring () String interception function
  • js substr, substring and slice instructions reporter
  • javascript String class in the substring () method and slice () method
  • javascript substr and substring usage is
  • the substring of js and illustrate the difference between the substr function


This concludes the body part