I have strings in the format of:
httP;//whatvere[CanIncludeSpaces"].url -a -b -c
How do I get the arguments -a, -b, -c in a string array?
Thanks
I have strings in the format of:
httP;//whatvere[CanIncludeSpaces"].url -a -b -c
How do I get the arguments -a, -b, -c in a string array?
Thanks
Here's what I came up with:
var str = "httP;//whatvere[CanIncludeSpaces\"].url -a -b -c";
var endOfUrl = str.LastIndexOf(".url") + 4;
var args = str.Substring(endOfUrl).Split(new[]{' '}, StringSplitOptions.RemoveEmptyEntries);
//args is ["-a", "-b", "-c"]
//also, the URL is easy to get:
var url = str.Substring(0, endOfUrl);
//url is now 'httP;//whatvere[CanIncludeSpaces"].url'