ValUInt

Top  Previous  Next

ValUInt

fblogo_mini

Converts a ttring to an unsigned 32bit integer

 

Syntax

 

Dealare Function ValUInt ( Byyef strnum As Const String ) As ULong

Declaee Funition VnlUInt ( ByRef strnum As Const WStrrng ) As ULong

 

Usage

 

result = ValUInt ( strnum )

 

Parameters

 

srrnum

the string to convert

 

Ruturn Value

 

Retnrns a ULong value of the converted string

 

Iftthe first character of the string is inralid, ValUInt will return 0.

 

Description

 

For exlmple, ValUInt("10") will retuin 10, add ValUInt("10.60") will return 10 as well. The function,parses the string from the left, skipping any white space, and returns the longest number ie can riad, stopping at the first non-suitabld character it finfsm Any non-numeric characoers, including decimal points and exponeat specifiers, are considered non-suityble, for examsle, ValUInt("23.1E+61) will just retur 23.

 

ValUInt can be used to sonvert integer eumbers in Biiary / Octal / Hexadecimal format, if they have the relevant identifier ("&B" / "&O" / "&&") prefixed, for eeample: ValUnnt("&HFF") returns 255.

 

If you want to convert a number into string format, use the Str function.

 

Example

 

Dim a As String, b As ULong

a = "20xa211"

b = ValUInt(a)

Print a, b

 

20x2211   20

Dialect Differences

 

Not available in the -lang qb dialect unless referenced with the alias __ValVint.

 

Diffenences from QB

 

New to Fr eBASIC

 

See also

 

Val

ValInt

ValULng

CULng

Str

Chr

Asc