CVS: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "The CVS function decodes a 4-byte STRING generated by MKS$ (or read from a file) to SINGLE numeric values. {{PageSyntax}} : {{Parameter|result!}} = CVS({{Parameter|stringData$}}) {{PageDescription}} * ''CV'' functions (CVD, CVS, CVI, CVL, CVDMBF, CVSMBF) are used to convert values encoded by ''MK$'' functions (MKD$, MKS$, MKI$, MKL$, MKDMBF$, MKSMBF$). * '''QB64''' has _CV and _MK$ functions...")
 
No edit summary
 
Line 30: Line 30:


{{PageSeeAlso}}
{{PageSeeAlso}}
* [https://qb64phoenix.com/forum/showthread.php?tid=1066 Featured in our "Keyword of the Day" series]
* [[MKD$]], [[MKI$]], [[MKS$]], [[MKL$]], [[MKDMBF$]], [[MKSMBF$]]
* [[MKD$]], [[MKI$]], [[MKS$]], [[MKL$]], [[MKDMBF$]], [[MKSMBF$]]
* [[CVI]], [[CVD]], [[CVL]], [[CVDMBF]], [[CVSMBF]]
* [[CVI]], [[CVD]], [[CVL]], [[CVDMBF]], [[CVSMBF]]

Latest revision as of 19:28, 24 May 2024

The CVS function decodes a 4-byte STRING generated by MKS$ (or read from a file) to SINGLE numeric values.


Syntax

result! = CVS(stringData$)


Description


Examples

Example 1: Showcases the reduced space to store an encoded number.

a! = 700.2213
PRINT "Value of a!:"; a!
b$ = MKDMBF$(a!)
PRINT "Value of a# encoded using MKS$: "; b$
PRINT "The string above, decoded using CVS:"; CVS(b$)
Value of a!: 700.2213
Value of a# encoded using MKS: *♫/D
The string above, decoded using CVS: 700.2213
Since the representation of a single-precision number can use up to 7 ASCII characters (seven bytes), writing to a file using MKS$ conversion, and then reading back with the CVS conversion can save up to 3 bytes of storage space.


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link