SubString


String.substring ( start , end )

One argument, we get the string starting from the specified index Inclusive until the end of the string.

sText = "abcdef" 
sSubText = sText.substring(2);
console.log(sSubText); // ab

Two arguments, we get the string starting from the first number to the end number Exclusive.

sText = "abcdef" 
sSubText = sText.substring(0, 2);
console.log(sSubText); // ab

String.substr ( start , length )


sText.substr(0,3) 

The second argument is the length




© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited TopPrevNext