isLiteral Method

Class: String

Description

This method indicates whether the value of the data stored in a String is a literal value.

A string represents a literal if either StringObject.isNumber() returns 1, OR if the first character and the last character of the string are the double quote character (") and all other occurrences of the double quote character occur in pairs.

Syntax

StringObject.isLiteral()

Parameters

None.

 

Returns

A Boolean:

 

1 if the string represents a literal.
0 if the string does not represent a literal.

When Became Available

v6.4

Example

type String STR1 = "ABCD"          // this is not a literal

type Boolean B1 = STR1.isLiteral() // 0

 

set STR1=STR1.addQuotes()          // addQuotes() creates literal

set B1 = STR1.isLiteral()          // 1

 

type String NUM = "123.45E3"       // isNumber() implies literal

type Boolean B2 = NUM.isLiteral()  // 1