Esempio n. 1
0
        public osUTF8Slice[] Split(char[] b, bool ignoreEmpty = true)
        {
            if (m_len == 0)
            {
                return(new osUTF8Slice[] { this });
            }

            bool               incEmpty = !ignoreEmpty;
            osUTF8Slice        tmp      = new osUTF8Slice(this);
            List <osUTF8Slice> lst      = new List <osUTF8Slice>();

            int indx;

            while ((indx = tmp.IndexOfAny(b)) >= 0)
            {
                osUTF8Slice o = tmp.SubUTF8(0, indx);
                if (incEmpty)
                {
                    lst.Add(o);
                }
                else if (o.m_len > 0)
                {
                    lst.Add(o);
                }
                tmp.MoveStart(indx + 1);
            }

            if (tmp.m_len > 0)
            {
                lst.Add(tmp);
            }
            return(lst.ToArray());
        }
Esempio n. 2
0
        public osUTF8Slice SubUTF8(int start, int len)
        {
            osUTF8Slice oss = new osUTF8Slice(this);

            return(oss.SubUTF8(start, len));
        }