Converting characters to/from numeric codes

Verified
Added by iNTERFACEWARE

Convert characters to/from numeric codes, the codes will vary depending on the code page settings

Source Code
   -- convert from character to code
   local A,B,C = string.byte('ABC', 1,3)
   -->65,66,67 
   
   local AString = 'ABC'
   local A,B,C = AString:byte(1,3)
   -->65,66,67 
   
   -- convert from code to character
   local AString2 = string.char(65,66,67)
   -->'ABC'
Description
Convert characters to/from numeric codes, the codes will vary depending on the code page settings
Usage Details

The code converts characters to numeric codes using string.byte(), and numeric codes to characters using string.char().

How to use the snippet:

  • Paste the desired conversion into your script