Basic HTML version of Foils prepared 23 June 1997

Foil 41 JavaScript String Methods - I

From JavaScript Tutorial for Certificate Course UC Web applications Certificate -- Summer 97. by Geoffrey C. Fox, Tom Scavo

Examples for String Object in JavaScript for Foil 41
The String object has one property:
myString.length gives string length in characters
JavaScript has only one type of String object, whereas Java has both String (fixed) and StringBuffer (mutable) classes
Characters are indexed from the left starting at 0 and ending with myString.length - 1
newstring = myString.substring(pos1,pos2);
returns the substring in position pos1 ... pos2 - 1
Peculiarly, if pos2 < pos1, the previous statement returns the substring in position pos2 ... pos1 - 1



Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed Apr 1 1998