METHOD:  String::charAt


This method returns a character from a string by referring to its index within that string. The characters in a string are indexed from left to right with the first character indexed as 0 and the last as String.length - 1.

The following code reads the characters from the string at the specified indicies and writes them to the document.

myString = new String("charAt method demonstration.")
document.write (myString.charAt(26))
document.write (myString.charAt(8))
document.write (myString.charAt(2))
document.write (myString.charAt(5))


Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information