Aurora.ScriptEngine.AuroraDotNetEngine.APIs.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 ) : Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list
src string
return Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.list
        public LSL_List llCSV2List(string src)
        {

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

            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return new LSL_List();


            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