Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,24 @@
class Main
{
// function to see if str contains a number of any of built-in types
static Bool readNum (Str str)
{
int := Int.fromStr (str, 10, false) // use base 10
if (int != null) return true
float := Float.fromStr (str, false)
if (float != null) return true
decimal := Decimal.fromStr (str, false)
if (decimal != null) return true
return false
}
public static Void main ()
{
echo ("For '2': " + readNum ("2"))
echo ("For '-2': " + readNum ("-2"))
echo ("For '2.5': " + readNum ("2.5"))
echo ("For '2a5': " + readNum ("2a5"))
echo ("For '-2.1e5': " + readNum ("-2.1e5"))
}
}