#!/usr/local/bin/spar pragma annotate( summary, "charcode" ) @( description, "Given a character value in your language, print its code (could be" ) @( description, "ASCII code, Unicode code, or whatever your language uses). For example," ) @( description, "the character 'a' (lowercase letter A) has a code of 97 in ASCII (as" ) @( description, "well as Unicode, as ASCII forms the beginning of Unicode). Conversely," ) @( description, "given a code, print out the corresponding character. " ) @( category, "tutorials" ) @( see_also, "http://rosettacode.org/wiki/Character_codes" ) @( author, "Ken O. Burtch"); pragma license( unrestricted ); pragma restriction( no_external_commands ); procedure charcode is code : constant natural := 97; ch : constant character := 'a'; begin put_line( "character code" & strings.image( code ) & " = character " & strings.val( code ) ); put_line( "character " & ch & " = character code" & strings.image( numerics.pos( ch ) ) ); end charcode;