Siebel eScript Language Reference > Methods Reference > String Methods >

Get Character From String Method


The Get Character From String method returns the character that resides at a specific location in a string. The length of this character is 1.

To get the first character in a string, you use position 0. For example:

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

To get the last character in a string, you use length minus 1. For example:

var lastchar = string1.charAt(string1.length - 1);

If the value in the position argument is not between 0 and the value of stringVar.length minus 1, then this method returns an empty string.

Format

stringVar.charAt(position)

Table 37 describes the arguments for the Get Character From String method.

Table 37. Arguments for the Get Character From String Method
Argument
Description

position

An integer that describes the position in the string of the character that this method returns. The position of the first character in the string is 0.

Siebel eScript Language Reference Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.