Section 24.162. String.charAt( ): get the nth character from a string


24.162. String.charAt( ): get the nth character from a string

ECMAScript v1

24.162.1. Synopsis

string.charAt(n)

24.162.1.1. Arguments

n

The index of the character that should be returned from string.

24.162.1.2. Returns

The nth character of string.

24.162.2. Description

String.charAt( ) returns the nth character of the string string. The first character of the string is numbered 0. If n is not between 0 and string.length-1, this method returns an empty string. Note that JavaScript does not have a character data type that is distinct from the string type, so the returned character is a string of length 1.

24.162.3. See Also

String.charCodeAt( ), String.indexOf( ), String.lastIndexOf( )




JavaScript. The Definitive Guide
JavaScript: The Definitive Guide
ISBN: 0596101996
EAN: 2147483647
Year: 2004
Pages: 767

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net