extract Method

Class: String

Description

This method extracts a portion of a string based on a specified first and last character to extract.

Syntax

String.extract(Number from,Number to)

Parameters

from

The first character in the string to extract. The default is 1.

to

The last character in the string to extract. The default is the value in the from parameter.

Returns

A substring.

When Became Available

v7.0

Example #1

type RecordDEP dep=Db.getRecord(“DEP”,”:CID”)

set IRN=dep.irn

set IRN=IRN.extract(1,2)

 

*CID must be defined prior to the getRecord statement

Example #2

type ResultSet rs=Db.select(“ACN,NAM”,”CIF”)

// get first three characters of name

while rs.next() set ABBR=rs.getCol("NAM").extract(1,3)