

Task

Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses).



Example

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.




 
@echo off

:: Supports all ASCII characters and codes from 34-126 with the exceptions of:
:: 38  &
:: 60  <
:: 62  >
:: 94  ^
:: 124 |
 
:_main
call:_toCode a
call:_toChar 97
pause>nul
exit /b
 
:_toCode
setlocal enabledelayedexpansion
set codecount=32
 
for /l %%i in (33,1,126) do (
  set /a codecount+=1
  cmd /c exit %%i 
  if %1==!=exitcodeAscii! (
    echo !codecount!
    exit /b
  )
)
 
:_toChar
setlocal
cmd /c exit %1
echo %=exitcodeAscii%
exit /b
 