Ejemplo n.º 1
0
        public static void FillRow(Object obj, out string segment, out int i)
        {
            SplitParts ab = (SplitParts)obj;

            segment = ab.result;
            i       = ab.id;
        }
Ejemplo n.º 2
0
        public static IEnumerable clrtvf_Split1(SqlString str, string splitChar)
        {
            // split str using delimiter in splitChar
            //and return it as table valued function
            // in format: segment varchar(max), row_number int

            string[]     m_strlist;
            SplitParts[] a;
            if (!str.IsNull)
            {
                m_strlist = str.Value.Split(splitChar.ToCharArray());
                int count = m_strlist.GetUpperBound(0);
                a = new SplitParts[count + 1];
                for (int i = 0; i < m_strlist.GetUpperBound(0) + 1; i++)
                {
                    a[i] = new SplitParts(i, m_strlist[i]);;
                }
                return(a);
            }
            else
            {
                return("");
            }
        }