JavaScript String Functions . . . the easy way

Posted by admin on May 14, 2008

Has it been a while since you’ve had to reverse a string in JavaScript? How about counting the number of occurrences of a specific sub-string within a string? Or converting a string to hex? And vice versa?

If you’re like me, you don’t deal with JavaScript string functions all day all the time, so you tend to forget some of the specific JavaScript string function syntax from time to time. Especially when you’re dealing with C#, T-SQL, VBScript and ActionScript at the same time.

Thanks to Marianne Wartoft, you can get just about all of your JavaScript string function needs fulfilled at www.string-functions.com.

The gist of it: For any JavaScript string function, there is an online tool that will perform the desired function right there in your web browser. Obviously, if you’re really desperate, you can always View Source the page code in any of those online tools to see how it’s done.

Hats off to Marianne for maintaining such an awesome niche site. The JavaScript string functions on her site include:

Reverse a String
Calcualte String Length
Count the Occurrences of a Substring within a String
Convert a String to Uppercase or Lowercase
HTML-Encode a String
HTML-Decode a String
Convert a String to Hex
Convert Hex to String
URL-Encode a String
URL-Decode a String
Convert Hex Values to RGB
Convert RGB Values to Hex

 

 

Leave a Reply