new files
This commit is contained in:
parent
3af7344581
commit
86c034bb8b
1364 changed files with 21352 additions and 0 deletions
|
|
@ -0,0 +1,3 @@
|
|||
package Numeric_Tests is
|
||||
function Is_Numeric (Item : in String) return Boolean;
|
||||
end Numeric_Tests;
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package body Numeric_Tests is
|
||||
function Is_Numeric (Item : in String) return Boolean is
|
||||
Dummy : Float;
|
||||
begin
|
||||
Dummy := Float'Value (Item);
|
||||
return True;
|
||||
exception
|
||||
when others =>
|
||||
return False;
|
||||
end Is_Numeric;
|
||||
end Numeric_Tests;
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
with Ada.Text_Io; use Ada.Text_Io;
|
||||
with Numeric_Tests; use Numeric_Tests;
|
||||
|
||||
procedure Is_Numeric_Test is
|
||||
S1 : String := "152";
|
||||
S2 : String := "-3.1415926";
|
||||
S3 : String := "Foo123";
|
||||
begin
|
||||
Put_Line(S1 & " results in " & Boolean'Image(Is_Numeric(S1)));
|
||||
Put_Line(S2 & " results in " & Boolean'Image(Is_Numeric(S2)));
|
||||
Put_Line(S3 & " results in " & Boolean'Image(Is_Numeric(S3)));
|
||||
end Is_Numeric_Test;
|
||||
Loading…
Add table
Add a link
Reference in a new issue