SourcePoint Intel Help

Table of Contents

Character Functions

Built-in functions for character classification and transformation.

Syntax

[result =] function(char-expr)

Where:

result

specifies the debug object to which the function return value is assigned. If result is not specified, or the return value is not used by another command, the return value is displayed on the next line of the screen.

function

specifies the name of the character function (see the following table).

char-expr

specifies a quoted character or an expression specifying a character.

Discussion

There are two classes of character functions: character classification and character transformation.

The character classification functions return a boolean data type with the value non-zero (true) or zero (false). These functions take a single argument (char-expr) that must be compatible with the int4 data type.

The character transformation functions return an int4 containing an ASCII-coded value. These functions take a single argument that must be compatible with the int4 data type.

Character Functions

Function

Discussion

isalpha

Returns true when char-expr is alphabetic. The hexadecimal values for these characters are 41 through 5a (A . . . Z) and 61 through 7a (a . . . z).

isupper

Returns true when char-expr is an uppercase alphabetic character. The hexadecimal values for these characters are 41 through 5a (A . . . Z).

islower

Returns true when char-expr is a lowercase alphabetic character. The hexadecimal values for these characters are 61 through 7a (a . . . z).

isdigit

Returns true when char-expr is a numeric digit. The hexadecimal values for these characters are 30 through 39 (0 . . . 9).

isxdigit

Returns true when char-expr is a hexadecimal digit. The hexadecimal values for these characters are 30 through 39 (0 . . . 9), 41 through 46(A . . . F), and 61 through 66 (a . . . f).

isalnum

Returns true when char-expr is alphanumeric. The hexadecimal values for these characters are 41 through 5a (A . . . Z), 61 through 7a (a . . . z), and 30 through 39 (0 . . . 9).

isspace

Returns true when char-expr is a blank. This blank can be a single space (hexadecimal value 20), carriage return, line feed (new line or "\n"), tab ("\t"), vertical tab, or form feed (new page or "\p").

ispunct

Returns true when char-expr is a punctuation mark (neither a control nor an alphanumeric character). The hexadecimal values for these characters are 21 through 2f, 3a through 40, 5b through 60, and 7b through 7e.

isprint

Returns true when char-expr is a printable character. The hexadecimal values for these characters are 20 through 7e.

iscntrl

Returns true when char-expr is a delete character (hexadecimal 7f) or any control character (hexadecimal 0 through 1f).

isascii

Returns true when char-expr is a coded value (hexadecimal 0 through 7f).

toupper

Returns the uppercase value of char-expr. If char-expr does not contain a lowercase letter, the result is the original char-expr, unchanged. The char-expr itself is not changed.

tolower

Returns the lowercase value of char-expr. If char-expr does not contain a uppercase letter, the result is the original char-expr, unchanged. The char-expr itself is not changed.

toint

Returns the "weight" of a hexadecimal digit: 0 - 9 for the characters "0" through "9", respectively, and 10 - 15 for the letters "a" through "f" (or "A" through "F"), respectively.

toascii

Clears all bits of char-expr that are not part of a standard ASCII character and returns this value. The char-expr itself is not changed.

Examples

Character classification functions:

Command input:

define char cvar = 'a'
define int4 ivar
ivar = cvar
ivar

Result:

00000061H

Command input:

isalpha(cvar)

Result:

TRUE

Command input:

isalpha(ivar)

Result:

TRUE

Command input:

define int4 answer = isalpha(cvar)
answer

Result:

00000001H

Command input:

cvar

Result:

'a'

Command input:

isupper(cvar)

Result:

FALSE

Command input:

islower(cvar)

Result:

TRUE

Command input:

cvar = 'a'
isupper(cvar)

Result:

TRUE

Command input:

isdigit(cvar)

Result:

FALSE

Command input:

isxdigit(cvar)

Result:

TRUE

Command input:

isalnum(cvar)

Result:

TRUE

Command input:

isspace(cvar)

Result:

FALSE

Command input:

ivar = 20H
isspace(ivar)

Result:

TRUE

Command input:

cvar = '!'
ispunct(cvar)

Result:

TRUE

Command input:

isprint(ivar)

Result:

TRUE

Command input:

cvar = 5
cvar

Result:

'\005'

Command input:

isprint(cvar)

Result:

FALSE

Command input:

iscntrl(cvar)

Result:

TRUE

Command input:

isascii(cvar)

Result:

TRUE

Character transformation functions:

Command input:

define int4 ivar = 5
define char cvar
cvar = toascii(ivar)
cvar

Result:

'\005'

Command input:

cvar = toascii(61H)
cvar

Result:

'a'

Command input:

toascii(cvar)

Result:

00000061H

Command input:

toupper(cvar)

Result:

00000041H

Command input:

cvar

Result:

'a'

Command input:

cvar = toupper(cvar)
cvar

Result:

'A'

Command input:

ivar = 41H
cvar = tolower(ivar)
cvar

Result:

'a'

Related Topics: