Siebel eScript Language Reference > Siebel eScript Commands > String Objects >

charAt() Method


This method returns a character at a certain place in a string.

Syntax

stringVar.charAt(position)

Parameter
Description

position

An integer indicating the position in the string of the character to be returned

Returns

A string of length 1 representing the character at position.

Usage

The character count starts at 0. To get the first character in a string, use index 0, as follows:

var string1 = "a string";
string1.charAt(0);

To get the last character in a string, use:

string1.charAt(string1.length - 1);

If position does not fall between 0 and stringVar.length - 1, stringVar.charAt() returns an empty string.

See Also

indexOf() Method
lastIndexOf() Method
String.fromCharCode() Static Method

Siebel eScript Language Reference