prepend message (with spaces) to a message without space

newtfish's icon

Hi,

Im trying to prepend a message that has spaces with one that does not.

It is giving me "/_1 add in here" with a space between the "/_1" and the "add in here" message. Whereas Im just trying to do "/_1add in here"

Combine and sprintf wont do this because one of the messages has spaces inside it (they treat it like a list).

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

Here is the example

brendan mccloskey's icon

Hi

if the "add" symbol is not a variable, you could pop it into the [prepend] object:

message "in here" ---> [prepend /_1add].

I have a feeling this isn't what you want though. I should look at [zl] and [sprintf] more.

Brendan

brendan mccloskey's icon
Max Patch
Copy patch and select New From Clipboard in Max.
newtfish's icon

cool thx :), i ended up doing it with combine in the end, turns out combine can deal with the message with spaces.

brendan mccloskey's icon

Ah, combine, of course. i forgot about him :)

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

fwiw Brendan's' solution works if you place quotes around- add in here

Roman Thilenius's icon

or, if the length of the list is always the same, just [pak]. for example you can set a multislider using [pak set 1 0.].

vincentrieuf's icon

Ow! thx a lot guys, just spent an hour or two going from sprintf, pak, pack, combine, zl.join...
The quote solution works great