OpenSim.Region.ScriptEngine.Shared.Api.LSL_Api.llCSV2List C# (CSharp) Method

llCSV2List() public method

The supplied string is scanned for commas and converted into a list. Commas are only effective if they are encountered outside of '<' '>' delimiters. Any whitespace before or after an element is trimmed.
public llCSV2List ( string src ) : OpenSim.Region.ScriptEngine.Shared.LSL_Types.list
src string
return OpenSim.Region.ScriptEngine.Shared.LSL_Types.list
        public LSL_List llCSV2List(string src)
        {

            LSL_List result = new LSL_List();
            int parens = 0;
            int start  = 0;
            int length = 0;

            m_host.AddScriptLPS(1);

            for (int i = 0; i < src.Length; i++)
            {
                switch (src[i])
                {
                    case '<':
                        parens++;
                        length++;
                        break;
                    case '>':
                        if (parens > 0)
                            parens--;
                        length++;
                        break;
                    case ',':
                        if (parens == 0)
                        {
                            result.Add(new LSL_String(src.Substring(start,length).Trim()));
                            start += length+1;
                            length = 0;
                        }
                        else
                        {
                            length++;
                        }
                        break;
                    default:
                        length++;
                        break;
                }
            }

            result.Add(new LSL_String(src.Substring(start,length).Trim()));

            return result;
        }
LSL_Api