cubloc:type_conversion:index
Table of Contents
Type Conversion
Type conversion can be used to convert the variable to the desired representation.
Hex
Converts the variable to a string representation of a hexadecimal value (16 bit). Hex8 means to convert to 8 decimal places. (1 to 8 can be used for decimal places)
Debug Hex A ' If A is 123ABC, 123ABC is printed Debug Hex8 A ' If A is 123ABC, bb123ABC is printed, ' b is a blank space in this case. Debug Hex5 A ' If A is 123ABC, 23ABC is printed, first character is cut.
Dec
Converts an integer variable to a string representation of a decimal (10 bit). Dec8 means to convert to 8 decimal places. (1 to 11 can be used for decimal places)
Debug Dec A ' If A is 1234, 1234 is printed. Debug Dec10 A ' If A is 1234, bbbbbb1234 is printed, ' b is a blank space in this case. Debug Dec3 A ' If A is 1234, 234 is printed, first character is cut
?
Include the name of the variable by using question mark (?). This question mark can only be used with HEX or DEC.
Debug Dec ? A ' If A is 1234, "A=1234" will be printed. Debug Hex ? A ' If A is &HABCD, "A=ABCD" will be printed. Debug Hex ? B ' If B is a variable within a subroutine ' (for example: subroutine CONV) with a value of ' &HABCD "B_@_CONV=ABCD" will be printed
Float
Use Float to convert floating point values to String.
Const Device = cb280 Dim F1 As Single F1 = 3.14 Debug Float F1,cr ' Print "3.14000". Dim ST As String * 15 ST = Float F1 ' First store in a String. ST = Left(ST,3) ' Convert to 3 decimal places Debug ST ' Print "3.14".
cubloc/type_conversion/index.txt · Last modified: by 127.0.0.1
