Separate a long number into smaller numbers

winterheartlee's icon

Hi there
I'm trying to figure out a way to split up a long number like 606569 into 60 65 69
I figured it would be a simple task but I've spent hours looking around the forum to no avail.
I've been looking at the regexp object, but I really dont understand the syntax for it so I'm not getting the right result :S
Pretty sure this will be an easy one for someone.
Thanks
Lee

o s's icon

hth

o

Max Patch
Copy patch and select New From Clipboard in Max.

MIB's icon
Max Patch
Copy patch and select New From Clipboard in Max.

since regexp gives me nightmares as well (I really ought to learn it one of these days) here is a more Max "friendly" way... sure there are better ones out there.

winterheartlee's icon

Thanks so much guys! Both these ways work perfectly.
Lee

Peter Castine's icon

And here's a way with arithmetic operators only. Modulo is your friend.

All of the solutions shown have issues with negative values. All also have the possible issue that the two-digit results drop leading zeros. Both of these issues left as an exercise for the reader.

Max Patch
Copy patch and select New From Clipboard in Max.

Peter Castine's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Oops… wanted to take a look at the first example before posting mine, then lost track of what was on the clipboard. So now I have to recreate the patch. Easily enough done…