Tag: Javascript
-
Truncate x characters from a string
Here’s a clever little function that enables you to, as the title suggests (!), truncate a predetermined number of a characters from a string: myStr = myStr.slice(0, -x) (where x is the number of characters to remove)
-
Split a string into an array based on a character
var foo = “09/22/2011”; var arr = foo.split(“/”); document.write(arr[0]+”<br>”) document.write(arr[1]+”<br>”)document.write(arr[2])