Method
CLong
Usage
result = CLong(str)
Part |
Type |
Description |
---|---|---|
result |
The numeric equivalent of the string passed. |
|
str |
Any valid string expression. |
Notes
The CLong function stops reading the string at the first character it doesn't recognize as part of a number. All other characters are automatically stripped.
It does recognize prefixes &o (octal), &b (binary), and &h (hexadecimal). However, spaces are not allowed in front of the ampersand. That is, "&hFF" returns 0, but "&hFF" returns 255.
CLong returns zero if string contains no numbers.
Sample code
This code use the CLong function to return the numbers contained in a string literal or a string variable
Var n As Int64
n = CLong("12345") ' returns 12345
n = CLong(" 12345") ' returns 0
n = CLong("123 45") ' returns 123
n = CLong("&hFFF") ' returns 4095
n = CLong("&b1111") ' returns 15
Compatibility
All project types on all supported operating systems.