--- xmlTools/trunk/posUpdate/Util.cs 2013/03/26 10:39:19 743 +++ xmlTools/trunk/posUpdate/Util.cs 2013/03/26 15:04:38 745 @@ -148,5 +148,17 @@ namespace xmlTools { return source.IndexOf(sToSearch, StringComparison.OrdinalIgnoreCase) >= 0; } + + // Thanks DarthDevilous for the regex! http://forums.thedailywtf.com/forums/t/2478.aspx + public static string[] stringToArgsArray(string args) + { + MatchCollection ms = Regex.Matches(args, "([^\" ]*(\"[^\"]*\")[^\" ]*)|[^\" ]+"); + List listArgs=new List(); + foreach (Match m in ms) + { + listArgs.Add(m.Value.Replace("\"","")); //remove quotes or it will cause an error + } + return listArgs.ToArray(); + } } }