Difference between revisions of "MAPUNICODE (function)"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
(Created page with 'The '''_MAPUNICODE''' function returns the UTF32 value of the ASCII character given. ''Syntax:'' UTFvalue& = _MAPUNICODE(Ascii_code%) * The UTF32 values have 4 byte enco…')
 
imported>SMcNeill
(style guidelines)
 
(13 intermediate revisions by one other user not shown)
Line 1: Line 1:
The '''_MAPUNICODE''' function returns the UTF32 value of the [[ASCII]] character given.
+
{{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%}})
  
''Syntax:'' UTFvalue& = _MAPUNICODE(Ascii_code%)
 
  
 
+
{{PageDescription}}
* The UTF32 values have 4 byte encoding so the return variable should be [[LONG]].
+
* UTF-32 values have 4-byte encoding so the return variable should be [[LONG]].
* The ''Ascii_code'' can be any [[INTEGER]] value from 0 to 255.
+
* The {{Parameter|asciiCode%}} can be any [[INTEGER]] value from 0 to 255.
 
* Returns can be used to verify or catalog the present Unicode mapping.
 
* Returns can be used to verify or catalog the present Unicode mapping.
* Since most Unicode mapping occurs above the normal keyboard code values, the code numbers cannot be derived from keypresses.
+
* The function returns Unicode values for the control characters, CHR$(127) and extended characters without mapping them first.
 
 
  
  
''See also:''
+
{{PageExamples}}
 +
''Example:'' Store function return values in an array for ASCII codes 0 to 255 to restore them later.
 +
{{CodeStart}}
 +
{{Cl|DIM}} Unicode&(255)
 +
{{Cl|SCREEN (statement)|SCREEN}} 0
 +
{{Cl|_FONT}} {{Cl|_LOADFONT}}("C:\Windows\Fonts\Cour.ttf", 20, "MONOSPACE") 'select monospace font
  
* [[_MAPUNICODE]] (statement)
+
{{Cl|FOR...NEXT|FOR}} ascii = 0 {{Cl|TO}} 255
 +
Unicode&(ascii) = {{Cl|_MAPUNICODE (function)|_MAPUNICODE}}(ascii)    'read Unicode values
 +
{{Cl|PRINT}} Unicode&(ascii);                  'display values in demo
 +
{{Cl|NEXT}}
 +
'rest of program
 +
{{Cl|END}}
 +
{{CodeEnd}}
  
* [[Unicode]], [[Code Pages]]
 
  
 +
{{PageSeeAlso}}
 +
* [[_MAPUNICODE]] {{text|(statement)}}
 +
* [[Unicode]], [[Code Pages]] {{text|(by region)}}
 
* [[ASCII]], [[CHR$]], [[ASC]]
 
* [[ASCII]], [[CHR$]], [[ASC]]
 +
* [[Text Using Graphics]]
  
  
 
{{PageNavigation}}
 
{{PageNavigation}}

Latest revision as of 14:10, 8 September 2017

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:
Keyword Reference - Alphabetical
Keyword Reference - By Usage
Main Wiki Page