Tokenize
Last changed: -82.148.98.34

.
Summary
        function tokenize(str,sep)
        {
                local start = 0;
                local idx;
                local charsep = sep.tochar();
                local ret = []
                while(idx = str.find(charsep,start)) {
                        ret.append(str.slice(start,idx));
                        start = idx+1;
                }
                if(start != str.len()) {
                        ret.append(str.slice(start,str.len()));
                }
                return ret;
        }


        local str = "1,2,3,123123,12312,2";


        foreach( i,val in tokenize(str,','))
        {
                ::print(val + "\n");
        }