Non-decimal radices/Input: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 1,522: | Line 1,522: | ||
say bin_noprefix.bin; # => 345 |
say bin_noprefix.bin; # => 345 |
||
say bin_withprefix.bin; # => 345</syntaxhighlight> |
say bin_withprefix.bin; # => 345</syntaxhighlight> |
||
=={{header|SparForte}}== |
|||
As a structured script. |
|||
<syntaxhighlight lang="ada">#!/usr/local/bin/spar |
|||
pragma annotate( summary, "radices" ) |
|||
@( description, "This task requires parsing of such a string (which may" ) |
|||
@( description, "be assumed to contain nothing else) using the" ) |
|||
@( description, "language's built-in facilities if possible. Parsing of" ) |
|||
@( description, "decimal strings is required, parsing of other formats" ) |
|||
@( description, "is optional but should be shown (i.e., if the language" ) |
|||
@( description, "can parse in base-19 then that should be illustrated)." ) |
|||
@( category, "tutorials" ) |
|||
@( author, "Ken O. Burtch" ) |
|||
@( see_also, "http://rosettacode.org/wiki/Non-decimal_radices/Input" ); |
|||
pragma license( unrestricted ); |
|||
pragma software_model( nonstandard ); |
|||
pragma restriction( no_external_commands ); |
|||
procedure radices is |
|||
begin |
|||
? numerics.value( "16#ABCF123#" ); |
|||
? numerics.value( "8#7651#" ); |
|||
? numerics.value( "2#1010011010#" ); |
|||
? numerics.value( "16#F.FF#E+2" ); |
|||
end radices;</syntaxhighlight> |
|||
=={{header|Standard ML}}== |
=={{header|Standard ML}}== |