Made an abstraction that will split a symbol by a delimiter using the new [list tosymbol] [list fromsymbol] methods (attached). (So this is for the newer vanilla versions ~0.46)
Uses [List_buffer] abstraction which is a cold-inlet growable list w/ bang to output and clear. This I created to suit the purpose I couldn't find anything similar in the list-abs. Thanks all, John. > On Sunday, 1 March 2015, 20:21, JF <sainti...@yahoo.com> wrote: > >T hanks Iohannes & Tim, > > > I would be interested in how to achieve this with [text]? > > I've been playing with text for the first time today, I thought that the > 'fields' were only whitespace separated. > > > if I had... > [text define longsymbols] > > > [symbol aaaa_bbbb ( > | > [text set longsymbols] > > ...how would I then retrieve the 'aaaa' and 'bbbb' separately? > > (Otherwise I will just use l2s/list2symbol) > > Thanks! John > > > > On Sunday, 1 March 2015, 19:21, tim vets <timv...@gmail.com> wrote: > > >> >> >> sorry, in that example, the last [unpack s s] should probably be [unpack f > s] >> >> >> >> 2015-03-01 20:17 GMT+01:00 tim vets <timv...@gmail.com>: >> >> maybe using s2l ? >>> something (roughly) like: >>> >>> [symbol drums_1.wav( >>> | [symbol _( >>> >>> | | >>> [s2l] >>> >>> [unpack s s] >>> >>> | >>> | [symbol .( >>> | | >>> [s2l] >>> [unpack s s] >>> >>> [f ] >>> | >>> [1\ >>> >>> gr, >>> >>> Tim >>> >>> >>> >>> >>> 2015-03-01 20:03 GMT+01:00 JF via Pd-list <pd-list@lists.iem.at>: >>> >>> Is it possible to split a formatted symbol such as... >>>> drums_1.wav >>>> >>>> ...to extract the float '1' and use that to assign a > meaningful attribute? >>>> >>>> >>>> For example a float could represent a loop playback switch. >>>> >>>> if I have 'drums_0.wav' I would like to extract the float, > find that it >>>> is '0' and then I would know that this WAV file is say, not > to be looped. >>>> Or if I had 'drums_1.wav' I would be able to parse the > filename, find the '1' >>>> which I now know to loop the WAV file. >>>> >>>> >>>> Thanks in advance! John >>>> >>>> _______________________________________________ >>>> Pd-list@lists.iem.at mailing list >>>> UNSUBSCRIBE and account-management -> > http://lists.puredata.info/listinfo/pd-list >>>> >>>> >>> >> >> >> >
#N canvas 708 421 308 321 10; #X obj 59 254 list; #X msg 103 86 1 2 3; #X obj 136 182 t b b; #X obj 201 222 t a; #X msg 113 106 a b c; #X obj 121 222 list prepend; #X obj 64 67 inlet; #X obj 21 67 inlet; #X obj 59 283 outlet; #X obj 156 124 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X text 173 183 bang clears; #X text 18 11 Growable list buffer \; Lists to the cold inlet are prepended \; Bang to hot outputs list then clears buffer; #X obj 21 213 t b b; #X obj 64 151 t a; #X connect 0 0 8 0; #X connect 1 0 13 0; #X connect 2 0 0 1; #X connect 2 1 5 1; #X connect 3 0 5 1; #X connect 4 0 13 0; #X connect 5 0 0 1; #X connect 5 0 3 0; #X connect 6 0 13 0; #X connect 7 0 12 0; #X connect 9 0 13 0; #X connect 12 0 2 0; #X connect 12 1 0 0; #X connect 13 0 5 0;
#N canvas 409 212 395 452 10; #X obj 19 163 list fromsymbol; #X msg 286 106 symbol -; #X obj 265 211 list fromsymbol; #X obj 19 193 u_listdrip; #X text 344 106 45; #X obj 19 329 List_buffer; #X obj 19 285 t b; #X obj 19 367 list tosymbol; #X obj 265 54 inlet; #X obj 19 414 outlet; #X msg 42 86 symbol hey-this-is-a$%££%"-easy; #X obj 19 54 inlet; #X text 15 12 Split a string by a given delimiter \; \$1 - delimiter character; #X obj 81 250 route; #X obj 302 145 loadbang; #X obj 302 167 symbol \$1; #X text 283 90 example; #X obj 265 190 symbol; #X text 41 70 example; #X connect 0 0 3 0; #X connect 1 0 17 0; #X connect 2 0 13 1; #X connect 3 0 13 0; #X connect 3 1 6 0; #X connect 5 0 7 0; #X connect 6 0 5 0; #X connect 7 0 9 0; #X connect 8 0 17 0; #X connect 10 0 0 0; #X connect 11 0 0 0; #X connect 13 0 6 0; #X connect 13 1 5 1; #X connect 14 0 15 0; #X connect 15 0 17 0; #X connect 17 0 2 0;
_______________________________________________ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list