0

It seems to be difficult to process Max/MSP strings character-by-character. I have been working on using two coll objects, one with input text as one word per line:

1, phone;

and the second with the substrings that I want to isolate from the input text:

ph, {other data}
o, {other data}
a, {other data}
ch, {other data}
ne, {other data}

What I need out of this comparison is a list of every possible substring for each input word, something like:

1, p,ph,h,o,n,ne,e; 

I want to say regexp will help here, but I can't have two inputs to dictate what to isolate. Further than that, any zl object seems to only allow for processing entire words. My source text is large, so efficiency matters.

Does anyone have advice for dealing with strings character-by-character in Max? Is there anything that sounds like it could accomplish this task?

aceslowman
  • 621
  • 13
  • 28

1 Answers1

1

atoi and itoa are the objects I typically use for tasks like this when doing it in Max.

A simple javascript object is probably more straight-forward though.

Mattijs
  • 1,909
  • 3
  • 19
  • 28
  • How do you think the two would compare efficiency-wise? I've never had to deal with the javascript objects before. – aceslowman Oct 07 '15 at 18:06
  • 1
    That depends on what part you do in js and what in max. The bridge between max and js is relatively slow but the js engine introduced in Max 6 is fast. If you need to send a lot of datapoints individually the the `js` object every 16 ms I would not go the js route. Since there is no way to access a coll directly in js, that would probably be the case. However if your data lived in a `dict` object, you can access the data directly from js with the Dict object and I believe you should go the js route. – Mattijs Oct 08 '15 at 06:53
  • Now zl.sect seems to be working well in conjunction with atoi, itoa, but now I'm wondering, is there a way to search linearly using zl.sect? It is pulling up "oe" for example, when those characters aren't near each other in "phone". – aceslowman Oct 09 '15 at 18:42
  • Could you paste your current patch (Edit -> Copy Compressed)? – Mattijs Oct 10 '15 at 06:49