It may be quite simple but, now that it's done...
I attach a [lastindexof] abstraction (which uses a [truncatesymbol]
abstraction also attached) which searches for the last occurrence of a
given character in a symbol.
I use it to search for the last occurrence of "/" in a full path, in
order to separate the path from the file name.
It takes the character to look for in the right inlet (as symbol), or as
a creation argument. When input a symbol in the left inlet, it outputs
the index of the last occurrence of the given character, or -1 if it is
not present.
It can be easily modified to search for the _first_ occurrence
([indexof]) and it should not be difficult to modify it so that the
searched symbol could be of any length (mantaining the same
computational inefficiencies it has now)
I am a vanilla purist (no disrespect at all to pd-extended)...
Ah, the [truncatesymbol] abstraction, which is basically a settable
[makefilename %.$1s], also manages the case of 0 characters by returning
a null symbol.
Dunnow if it will be of any use to anybody.....
bye
m.
--
Matteo Sisti Sette
matteosistisette@gmail.com
http://www.matteosistisette.com
#N canvas 279 55 710 709 12;
#X obj 195 43 inlet;
#X obj 497 108 inlet;
#X obj 211 133 until;
#X obj 210 206 symbol;
#X obj 229 303 truncatesymbol;
#X obj 303 257 f;
#X obj 341 258 + 1;
#X obj 209 165 t b b;
#X obj 295 409 list append $1;
#X msg 295 435 symbol $1$2;
#X obj 295 384 symbol;
#X obj 234 464 select -;
#X obj 234 500 f;
#X msg 357 331 symbol;
#X msg 333 227 0;
#X obj 201 72 t b b b a;
#X obj 307 164 select -;
#X obj 214 335 t a a a;
#X obj 210 234 t a b;
#X obj 256 99 s $0-reset;
#X obj 333 194 r $0-reset;
#X obj 358 306 r $0-reset;
#X obj 188 606 f -1;
#X obj 188 635 outlet;
#X obj 246 550 r $0-reset;
#X msg 245 580 -1;
#X connect 0 0 15 0;
#X connect 1 0 8 1;
#X connect 2 0 7 0;
#X connect 3 0 18 0;
#X connect 4 0 17 0;
#X connect 5 0 6 0;
#X connect 5 0 12 1;
#X connect 6 0 5 1;
#X connect 6 0 4 1;
#X connect 7 0 3 0;
#X connect 7 1 5 0;
#X connect 8 0 9 0;
#X connect 9 0 11 1;
#X connect 10 0 8 0;
#X connect 11 0 12 0;
#X connect 12 0 22 1;
#X connect 13 0 10 1;
#X connect 14 0 5 1;
#X connect 15 0 22 0;
#X connect 15 1 2 0;
#X connect 15 2 19 0;
#X connect 15 3 3 1;
#X connect 15 3 16 1;
#X connect 16 0 2 1;
#X connect 17 0 10 1;
#X connect 17 1 11 0;
#X connect 17 2 16 0;
#X connect 18 0 4 0;
#X connect 18 1 10 0;
#X connect 20 0 14 0;
#X connect 21 0 13 0;
#X connect 22 0 23 0;
#X connect 24 0 25 0;
#X connect 25 0 22 1;
#N canvas 442 184 450 509 12;
#X obj 95 104 inlet;
#X obj 171 104 inlet;
#X obj 171 150 select 0;
#X obj 139 248 switch2;
#X msg 171 221 0;
#X msg 207 220 1;
#X obj 222 87 loadbang;
#X obj 222 117 f $1;
#X obj 232 180 t b a;
#X msg 269 249 set %.$1s;
#X obj 220 342 makefilename;
#X obj 138 283 t b;
#X obj 139 411 outlet;
#X msg 138 370 symbol;
#X connect 0 0 3 0;
#X connect 1 0 2 0;
#X connect 2 0 4 0;
#X connect 2 1 8 0;
#X connect 3 0 11 0;
#X connect 3 1 10 0;
#X connect 4 0 3 1;
#X connect 5 0 3 1;
#X connect 6 0 7 0;
#X connect 7 0 2 0;
#X connect 8 0 5 0;
#X connect 8 1 9 0;
#X connect 9 0 10 0;
#X connect 10 0 12 0;
#X connect 11 0 13 0;
#X connect 13 0 12 0;