Difference between revisions of "&h"
From Xojo Documentation
m (→Sample Code) |
|||
Line 30: | Line 30: | ||
Assign a number using a hex literal: | Assign a number using a hex literal: | ||
<rbcode> | <rbcode> | ||
− | + | Var hex As Integer | |
hex = &hff // hex = 255 as a decimal integer | hex = &hff // hex = 255 as a decimal integer | ||
</rbcode> | </rbcode> | ||
Line 37: | Line 37: | ||
<rbcode> | <rbcode> | ||
− | + | Var myValue As Integer | |
myValue = Val("&h" + s) | myValue = Val("&h" + s) | ||
// If s is "A4", myValue will contain the value 164 which corresponds to &hA4 | // If s is "A4", myValue will contain the value 164 which corresponds to &hA4 |
Latest revision as of 23:26, 20 November 2019
Literal
Used to represent a hexadecimal literal.
Usage
&hHexNumber
Part | Type | Description |
---|---|---|
HexNumber | Hexadecimal number | A hexadecimal literal value. |
Notes
To write a hexadecimal literal, precede the value with &h.
Sample Code
Assign a number using a hex literal:
To get the numerical value (myValue) of a hexadecimal string (s):
Var myValue As Integer
myValue = Val("&h" + s)
// If s is "A4", myValue will contain the value 164 which corresponds to &hA4
myValue = Val("&h" + s)
// If s is "A4", myValue will contain the value 164 which corresponds to &hA4
See Also
Hex function.