next up previous contents
Next: charCodeAt Up: Methods Previous: Methods   Contents


charAt

Description
Retrieves the character at the index specified.


Syntax

  1. StringObj.charAt(index)
  2. "String Literal".charAt(index)


Parameters

index
The number of the character in the string to be returned.


returns

returns the character in the position specified by the parameter index. The index of the first character in a string is 0. If index is not a number from 0 to string.length - 1 , an empty string is returned.


Example

s = new String("Hello World");
s.charAt(2); //returns "l"




Copyright ©2000-2010 Shanghai TopCMM Software Technologies. All Rights Reserved.