Difference between revisions of "Talk:ParseString2List"
Jump to navigation
Jump to search
Huney Jewell (talk | contribs) (Huney's comment on Strife's answer) |
|||
Line 8: | Line 8: | ||
:Not really sure, was pretty tired by the time I made that contribution. The function naming standard is a bit informal. Seemed like a good idea at the time... which was after having spent many hours on a jet. I wrote it and posted it while I should have been packing for my trip last week, thanks for putting it in the library. -- [[User:Strife Onizuka|Strife Onizuka]] 21:22, 18 September 2007 (PDT) | :Not really sure, was pretty tired by the time I made that contribution. The function naming standard is a bit informal. Seemed like a good idea at the time... which was after having spent many hours on a jet. I wrote it and posted it while I should have been packing for my trip last week, thanks for putting it in the library. -- [[User:Strife Onizuka|Strife Onizuka]] 21:22, 18 September 2007 (PDT) | ||
---- | |||
Strife, maybe you misunderstood. What I'd like to say, is just concerning the '''name''' of this entry (not it's function): 'Parse String To List' instead of 'ParseString2List' as usual for LSL Functions. | |||
Greetz --[[User:Huney Jewell|Huney Jewell]] 01:39, 19 September 2007 (PDT) | |||
==Optimized== | ==Optimized== |
Revision as of 01:39, 19 September 2007
Hi Strife,
you did a really good job with this contribution. I just added a description of this script to 'LSL Script Library' section in Category 'LSL Library', but stumbled over this entry's name.
Why didn't you just name it 'ParseString2List' according to the standard naming conventions for functions?
Greetz --Huney Jewell 04:02, 18 September 2007 (PDT)
- Not really sure, was pretty tired by the time I made that contribution. The function naming standard is a bit informal. Seemed like a good idea at the time... which was after having spent many hours on a jet. I wrote it and posted it while I should have been packing for my trip last week, thanks for putting it in the library. -- Strife Onizuka 21:22, 18 September 2007 (PDT)
Strife, maybe you misunderstood. What I'd like to say, is just concerning the name of this entry (not it's function): 'Parse String To List' instead of 'ParseString2List' as usual for LSL Functions.
Greetz --Huney Jewell 01:39, 19 September 2007 (PDT)
Optimized
I wrote an optimized version for kicks, it should work but I haven't tested it yet. -- Strife Onizuka
list ParseString2List(string src, list separators, list spacers, integer ParseStringKeepNulls) {//works just like llParseString2List and llParseStringKeepNulls //Instead of each list being limited to 8, it is now 1024. //The max length of src is 2,097,151 bytes. integer offset = ~(separators != []); integer r = (spacers != []); integer i; spacers += separators; list out = "" + (separators = []); string p; while((offset = -~offset) < r) if(!~llListFindList(out, (list)(p = llList2String(spacers, offset)))) if(~(i = llSubStringIndex(src, p))) { separators += ((i + 0xFFF00000) << 11) | (i + 0x400); out += p; } out = []; offset = 0xFFF00000; while(separators) { p = llList2String(spacers, (r = (0x7FF & (i = llList2Integer(separators = llListSort(separators, 1, TRUE), 0)))) - 0x400); if(offset <= (i = (i >> 11))) { if(offset ^ i || ParseStringKeepNulls) out += llDeleteSubString(src, i - offset, -1); if(r & 0x400) out += p; src = llDeleteSubString(src, 0, ~(offset - (i += llStringLength(p)))); offset = i; } separators = llDeleteSubList(separators, 0, 0); if(~(i = llSubStringIndex(src, p))) separators += ((i + offset) << 11) | r; } if(src != "" || ParseStringKeepNulls) out += src; return out; }//Strife Onizuka