RU/2: Форум. Общение пользователей и разработчиков OS/2 (eCS). : The REXX Built-In Function DATATYPE - Syntax and Samples


Список сообщений | Написать новое | Ответить на сообщение | Домой Поиск:
Предыдущее сообщение | Следующее сообщение
From : GA
To : Igor Vaskov
Subj : The REXX Built-In Function DATATYPE - Syntax and Samples

Syntax:

DATATYPE(string,[type])

Description:

Returns the type of the string or indicates if string is a valid REXX number

Arguments:

string - the string whose type is needed

type - a string which contains a letter indicating the type to test for.

Returns 1 if a valid type character is specified and the string is of the specified type.

The valid type letters and assciciated characters are:

'A' - alphanumeric (a-z, A-Z, or 0-9)

'B' - binary (0 or 1)

'L' - lower case (a-z)

'M' - mixed case (a-z,A-Z)

'N' - number (a valid REXX number)

'S' - symbol (a-z,A-Z, 0-9, and period, !, ?, _, @, $, and + or - when used to express a number as in .04E-7)

'U' - upper case(A-Z)

'W' - whole number (a valid REXX whole number with current NUMERIC DIGITS)

'X' - hexadecimal (a-f, A-F, 0-9) (Blanks are allowed, as in hexidecimal literals)

Notes:

If the argument 'type' is not specified then NUM is returned if the argument 'string' is a valid REXX number, otherwise CHAR is returned

samples:

x = DATATYPE('DATA') /* 'CHAR' */

x = DATATYPE(' 750') /* 'NUM' */

Remark: The argument has two leading blanks before '750'


x = DATATYPE('a_$%') /* 'CHAR' */

If the argument 'type' is specified then 1 is returned if the string is of the specified type, otherwise 0 is returned

samples:

x = DATATYPE('big one','A') /* '0' */

Remark: between 'big' and 'one' is a blank!

x = DATATYPE('bigone','A') /* '1' */

The argument 'type' may be upper or lower case:

x = DATATYPE('ABCDEFG','a') /* '1' */

Further samples:

x = DATATYPE('ABC') /* 'CHAR' */

x = DATATYPE(' 25') /* 'NUM' */

Remark: the argument has a leading blank!

x = DATATYPE('351_') /* 'CHAR' */

x = DATATYPE('ABC.def','A') /* '0' - non alpha '.' */

x = DATATYPE('0011','B') /* '1' - binary */

x = DATATYPE('REXX','L') /* '0' - not lower case */

x = DATATYPE('REXX','M') /* '1' - mixed case */

x = DATATYPE('85.74', 'N') /* '1' - number */

x = DATATYPE('23.9E-2','S') /* '1' - all symbols */

x = DATATYPE('64','s') /* '1' - valid symbols */

x = DATATYPE('REXX','U') /* '1' - upper case */

x = DATATYPE('Short','U') /* '0' - mixed case */

x = DATATYPE('-45','W') /* '1' - REXX whole number */

x = DATATYPE('45.76','w') /* '0' - not whole number */

x = DATATYPE('FF25 AB','X') /* '1' - hexadecimal */

Remark: between 'FF25' and 'AB' is a blank

x = DATATYPE('ABG2351','x') /* '0' - not hexadecimal */

Sun 19 Oct 2003 17:18 Mozilla/4.61 [en] (OS/2; U)




Programmed by Dmitri Maximovich, Dmitry I. Platonoff, Eugen Kuleshov.
25.09.99 (c) 1999, RU/2. All rights reserved.
Rewritten by Dmitry Ban. All rights ignored.