Splitting text lines into single letters?
Target: The user should type two lines of text (up to 32 characters each). Each single letter must be translated to a certain number and the whole bunch sent to a synthesizer display as SysEx.
Problem: Using [umenu] for each letter is not a good option. Would be much better if the user could just type the text in. But I don't find a way to split a text into it's single letters. Is there a Max object that can do this? I need a serial output to send the letters sequentially to a [coll] that does the translation.
[atoi]
[zl iter 1]
or something like that might be a good starting point....
in that case you'd probably need to reference each letter as a number, but you could use [itoa] somewhere as well if it's important to keep them as letters.
Otherwise you could use [regexp (.)], and take your output from the backreference output - so that would solve the problem in one object - so you might prefer it....
Regards
Alex
[atoi] does what I want.
Thank you!
Oops,
there seems to be a bug in [atoi]. A bang to the left input gets interpreted as a symbol and I get the output "bang".
I can filter the word "bang" afterwards or maybe only if "bang" stands alone but this is not a good solution. Any other idea?
Max 5.0.6
It's a feature, not a bug ;)
bang
is a symbol like any other. When you send a list with a symbol as first element, the list is interpreted as a message, where the first symbol is the message name. Check the Messages section in the atoi reference and you see that it responds to the messages bang
and clear
.
Then, how would you get rid of the output "bang" when [atoi] is empty and you bang the left input by a button?
Mhm ... I think there is something basic I don't know ...
Got a similar problem with [textedit] – if it is empty and receives a bang, it sends the word "text" out. A [route] afterwards removes the "text" but then I get a bang. [route text bang] doesn't solve the problem.
---
An empty [atoi] receiving a bang puts out "bang".
An empty [textedit] receiving a bang puts out "text" and if "text" gets filtered, the final output changes to "bang".
How do I deal with this, when I don't want any output?
I'm not sure what problem is trying to be solved here, but textedit is the culprit for putting out "bang" as text. This works around that:
Yes this was the problem. atoi says also "bang", btw.
Thanks a lot.
I tried almost the same as a workaround with the litte difference that yours works and mine not. So I take yours if you don't mind.