1 // ByteFX.Data data access components for .Net
\r
2 // Copyright (C) 2002-2003 ByteFX, Inc.
\r
4 // This library is free software; you can redistribute it and/or
\r
5 // modify it under the terms of the GNU Lesser General Public
\r
6 // License as published by the Free Software Foundation; either
\r
7 // version 2.1 of the License, or (at your option) any later version.
\r
9 // This library is distributed in the hope that it will be useful,
\r
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
\r
12 // Lesser General Public License for more details.
\r
14 // You should have received a copy of the GNU Lesser General Public
\r
15 // License along with this library; if not, write to the Free Software
\r
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
20 using System.Collections;
\r
21 using System.Collections.Specialized;
\r
23 namespace ByteFX.Data.Common
\r
26 /// Summary description for StringUtility.
\r
28 public class StringUtility
\r
30 public StringUtility()
\r
34 public static string[] Split( string src, char delimiter, params char[] quotedelims )
\r
36 ArrayList strings = new ArrayList();
\r
37 StringBuilder sb = new StringBuilder();
\r
38 ArrayList ar = new ArrayList(quotedelims);
\r
39 char quote_open = Char.MinValue;
\r
41 foreach (char c in src)
\r
43 if (c == delimiter && quote_open == Char.MinValue)
\r
45 strings.Add( sb.ToString() );
\r
46 sb.Remove( 0, sb.Length );
\r
49 else if (ar.Contains(c))
\r
51 if (quote_open == Char.MinValue)
\r
53 else if (quote_open == c)
\r
54 quote_open = Char.MinValue;
\r
62 strings.Add( sb.ToString());
\r
64 return (string[])strings.ToArray(typeof(string));
\r