mirror of
https://github.com/QB64Official/qb64.git
synced 2024-09-28 11:17:47 +00:00
55 lines
1.7 KiB
Text
55 lines
1.7 KiB
Text
{{DISPLAYTITLE:_CV}}
|
|
The [[_CV]] function is used to convert [[_MK$]], [[ASCII]], [[STRING]] values to numerical values.
|
|
|
|
|
|
{{PageSyntax}}
|
|
:{{Parameter|result}} = [[_CV]]({{Parameter|numericalType}}, {{Parameter|MKstringValue$}})
|
|
|
|
|
|
{{PageParameters}}
|
|
* {{Parameter|numericalType}} is any number type: [[INTEGER]], [[LONG]], [[SINGLE]], [[DOUBLE]], [[_INTEGER64]], [[_FLOAT]], [[_BYTE]] or [[_OFFSET]].
|
|
* Integer, Long, Byte and Bit values can be signed or [[_UNSIGNED]].
|
|
* The {{Parameter|MKstringvalue$}} parameter must be a string value generated by [[_MK$]]
|
|
|
|
|
|
{{PageDescription}}
|
|
* The {{Parameter|MKstringvalue$}} value type must match the numerical type parameter used.
|
|
* [[_MK$]] [[STRING|string]] values consist of [[ASCII]] characters in the same byte length as the number value type.
|
|
|
|
|
|
{{PageExamples}}
|
|
''Example:'' Using the _MK$ and _CV functions:
|
|
{{CodeStart}} '' ''
|
|
{{Cl|DIM}} i64 {{Cl|AS}} {{Cl|_INTEGER64}}
|
|
{{Cl|DIM}} i64str {{Cl|AS}} {{Cl|STRING}}
|
|
|
|
i64 = 2 ^ 61
|
|
i64str = {{Cl|_MK$}}({{Cl|_INTEGER64}}, i64)
|
|
|
|
{{Cl|PRINT}} "I64:"; i64
|
|
{{Cl|PRINT}} "_MK$: "; i64str
|
|
|
|
i64 = {{Cl|_CV}}({{Cl|_INTEGER64}}, i64str)
|
|
{{Cl|PRINT}} "_CV:"; i64 '' ''
|
|
{{CodeEnd}}
|
|
{{OutputStart}}
|
|
I64: 2305843009213693952
|
|
_MK$:
|
|
_CV: 2305843009213693952
|
|
{{OutputEnd}}
|
|
:The _MK$ string result may not print anything to the screen, as in the example above, unless [[_CONTROLCHR]] is set to OFF.
|
|
|
|
|
|
{{PageSeeAlso}}
|
|
* [[_MK$]] {{text|(QB64 string conversion function)}}
|
|
* [[MKI$]], [[CVI]], [[INTEGER]]
|
|
* [[MKL$]], [[CVL]], [[LONG]]
|
|
* [[MKS$]], [[CVS]], [[SINGLE]]
|
|
* [[MKD$]], [[CVD]], [[DOUBLE]]
|
|
* [[MKSMBF$]], [[CVSMBF]] {{text|(Microsoft Binary Format)}}
|
|
* [[MKDMBF$]], [[CVDMBF]] {{text|(Microsoft Binary Format)}}
|
|
* [[PDS (7.1) Procedures#CURRENCY|CURRENCY]]
|
|
* [[_CONTROLCHR]]
|
|
|
|
|
|
{{PageNavigation}}
|