again: how to remove the last comma from message?

2-xite's icon

Hello C74 users,

would you please help me to remove just the last comma from this string?

keydown 55, keydown 0, keyup 0, keyup 55,

it should be (with other comma's between):
keydown 55, keydown 0, keyup 0, keyup 55

Its for aka.keyboard.

Tried everything (regexp and zl filter, have read this tut: https://hallluke.wordpress.com/2010/09/21/regular-expressions-in-maxmsp/ etc and after many hours of head braking and many, may open tabs on my browser of information I have to ask you!

Thank you in advance,
Al the best,

Alfredo

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

Is this string a message or a symbol? One way, if is in quotes:

2-xite's icon

Thank you for your attention, Ben!

This is a message list that I receive as a dump from the [coll] object.

The idea is to collect many keystrokes combinations (sometimes 2, 3 or a sequens of these, so the length of the message is variating a lot) and store it as a preset (for example in [patr]) en call up from a trigger.

Your solution works fantastic!

I was repeatedly wrong not to put the message-dump in quotes with the result that all elements were separated after the [regexp] and aka.keyboard did not "understood" the result.

Thank you again, I can happy continue.

All the best,

Alfredo

2-xite's icon

PS,

I'm sorry to ask again...

I can not get dump (actually a message: keydown 55, keyup 55, keydown 55, keyup 55, to a symbol) in to quotes.

So, how to convert this:
keydown 55, keyup 55, keydown 55, keyup 55,
to this:
"keydown 55, keyup 55, keydown 55, keyup 55,"

[tosymbol], [sprintf] etc breaks the line into separate words or picks just the last one. Not good...

Thank you in advance,

Alfredo

2-xite's icon

error examples attached...

from_message_to_symbol.maxpat
Max Patch
2-xite's icon

PS 2
... after few hours of reading and testing..., but thanks to this forum I found a brute solution:

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

I hope that there is a more elegant way, if so, please learn me!

Thanks in advance,

Alfredo