String manipulations in Javascripts
String.indexOf()
Return value:
-1 if not found
0 or higher than 0 as the index of the position found
Remove one part of a string
Method 1:
String.replace(//, "");
Method 2:
var indexEnd = myString.indexOf("CutHERE");
var newString = myString.substring(0, indexEnd);
Difference between String::substring() and String.substr()
With substring() the second parameter is the end index
With substr() the second parameter is the length to keep
Remove boundary whitespace : String.trim()
Use this from time to time
Recent Comments