| 148 |
|
{ |
| 149 |
|
return source.IndexOf(sToSearch, StringComparison.OrdinalIgnoreCase) >= 0; |
| 150 |
|
} |
| 151 |
+ |
|
| 152 |
+ |
// Thanks DarthDevilous for the regex! http://forums.thedailywtf.com/forums/t/2478.aspx |
| 153 |
+ |
public static string[] stringToArgsArray(string args) |
| 154 |
+ |
{ |
| 155 |
+ |
MatchCollection ms = Regex.Matches(args, "([^\" ]*(\"[^\"]*\")[^\" ]*)|[^\" ]+"); |
| 156 |
+ |
List<string> listArgs=new List<string>(); |
| 157 |
+ |
foreach (Match m in ms) |
| 158 |
+ |
{ |
| 159 |
+ |
listArgs.Add(m.Value.Replace("\"","")); //remove quotes or it will cause an error |
| 160 |
+ |
} |
| 161 |
+ |
return listArgs.ToArray(); |
| 162 |
+ |
} |
| 163 |
|
} |
| 164 |
|
} |