Game Maker Games, Articles, Tutorials & More

Game Maker Network


Howdy, Guest! Please sign in or register an account.

Print

parseInt

By Daniel · March 21, 2009

Parse a numeric string in some specified base and the quantity as an integer

// parseInt(n, radix)

var n, r, m, s;
n = abs(real(argument0));
r = argument1;
m = 1; s = 0;

while (n) {
  s += n mod 10 * m;
  m *= r; n = n div 10;
}

return sign(real(argument0)) * s;

Comments

There are no comments to display.

Post a Comment

You must be signed in to post comments.

Advertisement