MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: Interesting code...



Kipp the Kidd drew these hieroglyphs:
> 
> Can anyone come up with some 1.8.0 MOO code that, when given this:
> 
>    "%{a,b%{c,d}e,f,%{g,%{h}},i}"
> 
> Returns this:
> 
> {"a","b%{c,d}e","f","%{g,%{h}}","i"}

Here's what I pulled off the top of my head.  I'm assuming there are
no embedded commas or spaces in your list items.  I haven't tested it
but it feels right.

lst = args[1];
lst[1] = "";	/* get rid of leading percent-sign */
lst = $string_utils:strip_chars(lst," ");
lst = strsub(lst, ",", "\",\"");
return $no_one:eval_d(lst);

> I've got an extremely tick-greedy version, but of course, I don't want to 
> use that...  Could anyone do better?  Pavel? :)

Ask us and let Pavel do server work, 'kay?


Follow-Ups: References:

Home | Subject Index | Thread Index