MAPUNICODE (function): Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "{{DISPLAYTITLE:_MAPUNICODE (function)}} The _MAPUNICODE function returns the Unicode (UTF-32) code point value of a mapped ASCII character code. {{PageSyntax}} : {{Parameter|utfValue&}} = _MAPUNICODE({{Parameter|asciiCode%}}) {{PageDescription}} * UTF-32 values have 4-byte encoding so the return variable should be LONG. * The {{Parameter|asciiCode%}} can be any INTEGER value from 0 to 255. * Returns can be used to verify or catalog the present...")
 
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 18: Line 18:
{{CodeStart}}
{{CodeStart}}
{{Cl|DIM}} Unicode&(255)
{{Cl|DIM}} Unicode&(255)
{{Cl|SCREEN (statement)|SCREEN}} 0
{{Cl|SCREEN}} 0
{{Cl|_FONT}} {{Cl|_LOADFONT}}("C:\Windows\Fonts\Cour.ttf", 20, "MONOSPACE") 'select monospace font
{{Cl|_FONT}} {{Cl|_LOADFONT}}("C:\Windows\Fonts\Cour.ttf", 20, "MONOSPACE") 'select monospace font


Line 25: Line 25:
{{Cl|PRINT}} Unicode&(ascii);                  'display values in demo
{{Cl|PRINT}} Unicode&(ascii);                  'display values in demo
{{Cl|NEXT}}
{{Cl|NEXT}}
  'rest of program  
  'rest of program
{{Cl|END}}
{{Cl|END}}
{{CodeEnd}}
{{CodeEnd}}
Line 31: Line 31:


{{PageSeeAlso}}
{{PageSeeAlso}}
* [[_MAPUNICODE]] {{text|(statement)}}
* [https://qb64phoenix.com/forum/showthread.php?tid=1169 Featured in our "Keyword of the Day" series]
* [[Unicode]], [[Code Pages]] {{text|(by region)}}
* [[_MAPUNICODE]]
* [[ASCII]], [[CHR$]], [[ASC]]
* [[Unicode]], [[Code Pages]]
* [[ASCII]], [[CHR$]], [[ASC (function)]]
* [[Text Using Graphics]]
* [[Text Using Graphics]]




{{PageNavigation}}
{{PageNavigation}}

Latest revision as of 20:01, 24 May 2024

The _MAPUNICODE function returns the Unicode (UTF-32) code point value of a mapped ASCII character code.


Syntax

utfValue& = _MAPUNICODE(asciiCode%)


Description

  • UTF-32 values have 4-byte encoding so the return variable should be LONG.
  • The asciiCode% can be any INTEGER value from 0 to 255.
  • Returns can be used to verify or catalog the present Unicode mapping.
  • The function returns Unicode values for the control characters, CHR$(127) and extended characters without mapping them first.


Examples

Example: Store function return values in an array for ASCII codes 0 to 255 to restore them later.

DIM Unicode&(255)
SCREEN 0
_FONT _LOADFONT("C:\Windows\Fonts\Cour.ttf", 20, "MONOSPACE") 'select monospace font

FOR ascii = 0 TO 255
Unicode&(ascii) = _MAPUNICODE(ascii)     'read Unicode values
PRINT Unicode&(ascii);                   'display values in demo
NEXT
 'rest of program
END


See also



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