delete space in a list

May 16, 2011 at 5:50pm

delete space in a list

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

#56759
May 16, 2011 at 6:16pm

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

hth ole

– Pasted Max Patch, click to expand. –
#203416
May 16, 2011 at 6:37pm

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

#203417
May 16, 2011 at 6:54pm

[regexp] will do this for you.

– Pasted Max Patch, click to expand. –
#203418
May 16, 2011 at 6:57pm

YES! so easy :)

thank you

#203419
May 17, 2011 at 6:18am

 
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

#203420
May 17, 2011 at 2:05pm

a math solution, just for fun.

– Pasted Max Patch, click to expand. –
#203421
May 19, 2011 at 10:28am

Nice one!

#203422
May 19, 2011 at 10:34am

@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. –
#203423

You must be logged in to reply to this topic.