Lua - Character and Byte Representations Code Example

The code for Character and Byte Representations

-- Byte value of first character
print(string.byte("Hello, world"))

-- Byte value of third character
print(string.byte("Hello, world",3))

-- Byte value of the first character from last
print(string.byte("Hello, world",-1))

-- Byte value of the second character from the last
print(string.byte("Hello, world",-2))

-- Internal Numeric ASCII Conversion
print(string.char(72))

--[[
Output:
72
108
100
108
H
--]]
Code by IncludeHelp, on August 25, 2022 23:10

Comments and Discussions!





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.