SourcePoint AMD Help

Table of Contents

strtoul

Convert a string into an ord4 variable.

Syntax

[result =] strtoul(string-expr, base)

Where:

result

specifies a debug variable of type ord4 to which the function return value is assigned. If result is not specified, the return value is displayed on the next line of the screen.

string-expr

specifies an nstring variable or a quoted string constant.

base

the number base to be used in the conversion (2-36).

Discussion

The strtoul command converts a string into an ord4 variable. The strtoul function expects the number to be converted to consist of

  1. A sequence of digits whose legal values are indicated by the base specified (e.g., a base of 16 indicates 0-9, a-f and A-F are legal values.)

  2. As a special case, if base is 16, then the string may begin with a 0x or 0X.

The conversion stops at the end of the string or after encountering an illegal character. If no conversion can be performed, then zero is returned.

Example 1

Command input:

base=10t
strtoul("123", 10)

Result:

123T

Example 2

Command input:

base=16t
define ord4 answer
answer = strtoul("0x1000", 16t)
answer

Result:

00001000H

Example 3

Command input:

base=10t
define nstring myString = "2048 cars"
strtoul(myString, 10)

Result:

2048T

Related Topics: