What Methods are available with the String object?

The String object holds useful methods for manipulating the character strings you are using within your javascript. These methods can be substituted in your javascript wherever character values are allowed. The String object is pre-defined so does not need to be defined before use. The following simple methods are supported by the String object in all versions of Javascript (there are more advanced methods available in Javascript 1.2 and these will be discussed separately):

Many of these methods are equivalent to placing the string between the appropriate tags.
For example document.write(mystring.href("index.html"); is equivalent to
document.write('<a href="index.html">' + mystring + '<\/a>');.
Some of these methods are equivalent to surrounding the string with tags that are no longer supported by the latest xhtml version.

 

This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow
Donate