File : charcode.sp
$ spar charcode
character code 97 = character a
character a = character code 97
|
#!/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. " )
@( 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;
char : constant character := 'a';
begin
put_line( "character code" & strings.image( code ) & " = character " & strings.val( code ) );
put_line( "character " & char & " = character code" & strings.image( numerics.pos( char ) ) );
end charcode;
-- VIM editor formatting instructions
-- vim: ft=spar