Start Back Next End
  
ZBasic System Library
335
ZBasic Microcontrollers
ValueI
Type
Subroutine
Invocation
ValueI(str, val, flag) 
Parameter
Method
Type
Description
str
ByVal
String
The string from which to extract an Integer value.
val
ByRef
int16
The variable to receive the value.
flag
ByRef
Boolean
The variable to receive a success indicator.
Discussion
This routine converts a character representation of an integral number, contained in the str parameter,
to an Integer value returned in the val parameter.  If the string is in an acceptable format, the flag
parameter is set to True.  Otherwise, the flag parameter is set to False and the val parameter will be
0.
The string may contain any number of leading and/or trailing spaces.  The value itself may consist of an
optional plus or minus sign, an optional radix indicator, and one or more digits.  The supported radix
indicators are &H for hexadecimal, &O for octal and &B or &X for binary (all case insensitive).  If no radix
indicator is present, decimal is assumed.
If the provided string has the proper format but represents a value that is too large or too small to be
represented as an Integer, the result will be invalid but no such indication will be given.
Examples of integral values accepted by ValueI() are:
103
+123
&H55
-&B01101
Compatibility
This function is not available in BasicX compatibility mode.
See Also
Previous page Top Next page