9.3 Convert object
Description
You can convert data types with the Convert object.
List of methods/properties
Name | Type | Short description |
DecimalComma | Property | Specifies wether a comma or a point is used for decimal separation |
Byte | Method | Converts to the data type byte |
Word | Method | Converts to the data type word |
Dword | Method | Converts to the data type dword |
Double | Method | Converts to the data type double |
Switch | Method | Converts to the data type switch |
String | Method | Converts to the data type string |
Angle | Method | Converts between different angle formats |
Description
If this switch is activated then a comma is used for decimal separation instead of a point. This property affects only conversion from double to string.
Syntax
Data type
Switch
Type
Property
Example
1
2
$
Convert.DecimalComma = True
Description
Converts each data type into the data type byte.
Syntax
Return value
Byte
Type
Method
Parameter: Number
Description
The number which should be converted.
Data type
All
Range
0 to 255
Example
1
2
$
d[1] = Convert.Byte(v[1])
Description
Converts each data type into the data type word.
Syntax
Return value
Word
Type
Method
Parameter: Number
Description
The number which should be converted.
Data type
All
Range
-32768 to 32767
Example
1
2
$
d[1] = Convert.Word(v[1])
Description
Converts each data type into the data type dword.
Syntax
Return value
Dword
Type
Method
Parameter: Number
Description
The number which should be converted.
Data type
All
Range
-2147483648 to 2147483647
Example
1
2
$
d[1] = Convert.Dword("1234")
d[1] whould be at end: 1234
Description
Converts each data type into the data type double.
Syntax
Return value
Double
Type
Method
Parameter: Number
Description
The number which should be converted.
Data type
All
Range
-1.7E+308 to +1.7E+308
Example
1
2
$
f[1] = Convert.Double(v[1])
Description
Converts each data type into the data type switch.
Syntax
Return value
Switch
Type
Method
Parameter: Number
Description
The number which should be converted.
Data type
All
Range
0 to 1
Example
1
2
$
s[1] = Convert.Switch(v[1])
Description
Converts each data type into the data type string.
Syntax
Return value
String
Type
Method
Parameter: Number
Description
The number which should be converted.
Data type
All
Range
All valid numbers
Example
1
2
$
a[1] = Convert.String(v[1])
Description
Syntax
1
Convert.Angle(Angle, FormatFrom, FormatTo)
Return value
Double
Type
Method
Parameter: Angle
Description
The angle which should be converted.
Data type
Double
Range
All valid angles
Parameter: FormatFrom
Description
The angle format which is currently used for the angle.
Data type
Dword
Range
1 to 4 (Constants: DEG, RAD, GRAD and RPG)
Parameter: FormatTo
Description
The angle format which shall be converted to.
Data type
Dword
Range
1 to 4 (Constants: DEG, RAD, GRAD and RPG)
Example
1
2
$
v[1] = Convert.Angle(90, DEG, RPG)
v[1] whould be at end: 64