Tutorial Trim First/Last Characters in String
Remove last four characters var myString = "abcdefg"; var newString = myString.substr(0, myString.length-4); // newString is now ...
https://iskablogs.blogspot.com/2014/03/tutorial-trim-firstlast-characters-in.html
Remove last four characters
var myString = "abcdefg";
var newString = myString.substr(0, myString.length-4);
// newString is now "abc"
Remove first two characters
var myString = "abcdefg";
var newString = myString.substr(2);
// newString is now "cdefg"
Notes
The substr function can be called on any string with two integer parameters, the second optional. If only one provided, it starts at
var myString = "abcdefg";
var newString = myString.substr(0, myString.length-4);
// newString is now "abc"
Remove first two characters
var myString = "abcdefg";
var newString = myString.substr(2);
// newString is now "cdefg"
Notes
The substr function can be called on any string with two integer parameters, the second optional. If only one provided, it starts at