2010年2月8日 星期一
2010年2月6日 星期六
How do I convert a string to a number?
How do I convert a string to a number?
Use this atoi function:
sub atoi {
my $t;
foreach my $d (split(//, shift())) {
$t = $t * 10 + $d;
}
return $t;
} $number = atoi("123");
訂閱:
文章 (Atom)