Difference between revisions of "LlParseStringKeepNulls"

From Second Life Wiki
Jump to navigation Jump to search
Line 9: Line 9:
** ''integer my_int = (integer)llList2String(my_list,i);''
** ''integer my_int = (integer)llList2String(my_list,i);''
|constants
|constants
|examples=<pre<default
|examples=<pre>default
{
{
     state_entry()
     state_entry()
Line 26: Line 26:
}</pre>
}</pre>
|helpers
|helpers
|also_functions=*{{LSLG|llParseString2List}}
|also_functions={{LSL DefeneRow||[[llParseString2List]]|}}
*{{LSLG|llDumpList2String}}
{{LSL DefeneRow||[[llDumpList2String]]|}}
*{{LSLG|llCSV2List}}
{{LSL DefeneRow||[[llCSV2List]]|}}
*{{LSLG|llList2CSV}}
{{LSL DefeneRow||[[llList2CSV]]|}}
|also_events
|also_events
|also_tests
|also_tests

Revision as of 17:52, 8 March 2007

Summary

Function: list llParseStringKeepNulls( string src, list separators, list spacers );

Returns a list that is src broken into a list, discarding separators, keeping spacers, keeping any null values generated.

• string src
• list separators
• list spacers

separators and spacers must be lists of strings, maximum of 8 each.

Caveats

  • Every element in the list will be a string, no matter what you think it should be. Cast the results of llList2String to get what you want.
    • integer my_int = (integer)llList2String(my_list,i);
All Issues ~ Search JIRA for related Bugs

Examples

default
{
    state_entry()
    {
        // This will say:
        // <A><crazy><fox><.><Saw><the><moon><.><.>
        string my_string = "A crazy fox.  Saw the moon..";
        list my_list = llParseString2List(my_string,[" "],["."]);
        llOwnerSay("<" + llDumpList2String(my_list,"><") + ">");
        
        // This will say:
        //  <A><crazy><fox><.><><><Saw><the><moon><.><><.><>
        my_list = llParseStringKeepNulls(my_string,[" "],["."]);
        llOwnerSay("<" + llDumpList2String(my_list,"><") + ">");
    }
}

Deep Notes

Search JIRA for related Issues

Signature

function list llParseStringKeepNulls( string src, list separators, list spacers );