How to resolve the algorithm Character codes step by step in the langur programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Character codes step by step in the langur programming language
Table of Contents
Problem Statement
Given a character value in your language, print its code (could be ASCII code, Unicode code, or whatever your language uses).
The character 'a' (lowercase letter A) has a code of 97 in ASCII (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out the corresponding character.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Character codes step by step in the langur programming language
Source code in the langur programming language
val .a1 = 'a'
val .a2 = 97
val .a3 = "a"[1]
val .a4 = s2cp "a", 1
val .a5 = [.a1, .a2, .a3, .a4]
writeln .a1 == .a2
writeln .a2 == .a3
writeln .a3 == .a4
writeln "numbers: ", join ", ", [.a1, .a2, .a3, .a4, .a5]
writeln "letters: ", join ", ", [cp2s(.a1), cp2s(.a2), cp2s(.a3), cp2s(.a4), cp2s(.a5)]
You may also check:How to resolve the algorithm Julia set step by step in the Sidef programming language
You may also check:How to resolve the algorithm Bioinformatics/base count step by step in the Action! programming language
You may also check:How to resolve the algorithm FizzBuzz step by step in the Dyalect programming language
You may also check:How to resolve the algorithm Pascal matrix generation step by step in the PureBasic programming language
You may also check:How to resolve the algorithm Fibonacci sequence step by step in the ML/I programming language