forked from Mirrors/openclonk
Remove StringToInteger function
parent
f44aaf6ff7
commit
73b52a15ce
|
@ -49,20 +49,4 @@ global func CharIsLowerCase(int char)
|
|||
global func CharIsUpperCase(int char)
|
||||
{
|
||||
return Inside(char, 65, 90);
|
||||
}
|
||||
|
||||
// Converts a string to an integer if it consists of digits only.
|
||||
global func StringToInteger(string str)
|
||||
{
|
||||
var integer = 0;
|
||||
var power = 0;
|
||||
for (var index = GetLength(str) - 1; index >= 0; index--)
|
||||
{
|
||||
var char = GetChar(str, index);
|
||||
if (!CharIsDigit(char))
|
||||
return nil;
|
||||
integer += (char - 48) * 10**power;
|
||||
power++;
|
||||
}
|
||||
return integer;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue