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 )


The second argument is the length

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