1
0

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

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

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;
}