VALで二進数を扱えるようにした

This commit is contained in:
otya128 committed 2015-08-23 11:48:46 +09:00
1 parent e7f13edaec
commit 6df9bc25f8
2 files changed
+12 -1

No files matched your search

+5 -1
View File
@@ -226,10 +226,14 @@ class BuiltinFunction
{
try
{
if(str[0..2] == "&H")
if(str.length > 2 && str[0..2] == "&H")
{
return str[2..$].to!int(16);
}
if(str.length > 2 && str[0..2] == "&B")
{
return str[2..$].to!int(2);
}
double val = str.to!double;
return val;
}