Forums > MaxMSP

delete space in a list

May 16, 2011 | 5:50 pm

Hello,

how to turn a list like 1 2 3 4 to 1234 ?

the number of strings in the list will nbe random between 1 and 8.

example: it can be 1 3 to 13 or 1 2 3 4 5 6 7 to 1234567

thanks



o s
May 16, 2011 | 6:16 pm

if you can make the strings the same length you can use [sprintf]…

hth ole

– Pasted Max Patch, click to expand. –

May 16, 2011 | 6:37 pm

that’s the thing the strings aer never the same length.


May 16, 2011 | 6:54 pm

[regexp] will do this for you.

– Pasted Max Patch, click to expand. –

May 16, 2011 | 6:57 pm

YES! so easy :)

thank you


May 17, 2011 | 6:18 am

 
if 8 is really the maximum [sprintf %s%s%s%s%s%s%s%s] should also work for "1 2 3 4 5".

if 8 is really the maximum and it is only about numbers between 0 and 9, there is also a
simple solution using plain math. :)
 
-110


May 17, 2011 | 2:05 pm

a math solution, just for fun.

– Pasted Max Patch, click to expand. –

May 19, 2011 | 10:28 am

Nice one!


May 19, 2011 | 10:34 am

@bkshepard

by the way, is it possible to have {regexp} still working if you gave him just one string?
this is the way i do it for now..

– Pasted Max Patch, click to expand. –

Viewing 9 posts - 1 through 9 (of 9 total)