Extracting Digits (from a number) as Integers.

BigCatBigCat Member, BASIC Posts: 19
edited November -1 in Working with GS (Mac)
Hey folks!
Lets say I have an attribute: game.number=4250
I would like to create an expression which will look at game.number and tell me what the last 2 digits are. Or the last digit... or even the last 3 digits for that matter.

Comments

  • EastboundEastbound Member, BASIC Posts: 1,074
    To find the last 2, set some attribute to game.number % 100. The % sign is modulus, and it basically gives you the remainder of dividing by some number. So to find the last 3, you would do modulus by 1000, etc.
  • BigCatBigCat Member, BASIC Posts: 19
    Hmmmm, this seems like it might be exactly what I'm lookin fer! Thanks!
Sign In or Register to comment.