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

length Property


The length property stores an integer indicating the length of the string.

Syntax

stringVar.length

Parameter
Description
Not applicable
 

Returns

Not applicable

Usage

The length of a string can be obtained by using the length property. For example:

var string1 = "No, thank you.";
TheApplication().RaiseErrorText(string1.length);

displays the number 14, the number of characters in the string. Note that the index of the last character in the string is equivalent to stringVar.length -1, because the index begins at 0, not at 1.

Example

This code fragment returns the length of a name entered by the user (including spaces).

var userName = "Christopher J. Smith";
TheApplication().RaiseErrorText( "Your name has " +
   userName.length + " characters.");


 Siebel eScript Language Reference 
 Published: 18 April 2003