Conversion of data types
1.
Various decimal conversion functions
The conversion functions between databases involved in VB mainly include the following:
hexadecimal
Function:
Returns a that represents a hexadecimal value.
String;
October
Function:
Returns a Variant that represents the octal value of a numeric value.
(character string);
Cint function:
Forces the expression to be converted to-32,768.
Until/very
An integer of 32767;
CLng function:
Coercively convert the expression to -2,147,483,648.
Until/very
Long integer of 2 147483647;
Cdec function:
Forces the expression to be converted to decimal.
Data type;
CDbl function:
Forces an expression to be converted to a double value.
Data type;
Example:
( 1)
A = hexadecimal (5)
Return 5;
(2)
B = hexadecimal (10)
Return to a
(3)
C = hexadecimal (23)
Return to 17
(4)
D = October (5)
Return to page 5
(5)
E = October (10)
Return 12
(6)
F =1October 23rd
Back to the 27th
(7)
g = Cint(& amp; H 17)
Go back to page 23
(8)
h = Cint(& amp; O 12)
Return 10
It is worth mentioning that both Hex function and Oct function return strings. If you want to convert hexadecimal or octal string variables into decimal, you can do it as follows:
C=" 17 "
17 is a string of hexadecimal values.
C = " & amph "
& amp
C
IC = Cint (℃)
Go back to page 23
2.
String and number conversion function
Str () and Val () are used to convert strings and numbers to each other;
Chr () and Asc () are used for conversion between strings and AscII codes;
Chrw () and Ascw () are used for the conversion between Unicode encoding and Chinese;
The Format () function is a very general function with very powerful functions.
Example:
( 1)
My string
=
String (-459.65)
'
return
"-459.65"。
My string
=
String (459.00 1)
'
return
"
459.00 1"。
(2)
My value
=
Val ("
2
45
7")
'
return
2457。
My value
=
Val("24
and
57")
'
return
24。
(3)
MyChar
=
Commission on Human Rights (97)
'
return
Answer.
MyChar
=
Commission on Human Rights (37)
'
return
%。
(4)
My number
=
Apple Inc
'
return
65。
My number
=
Asc("a ")
'
return
97。