commandlineparser / commandline

The best C# command line parser that brings standardized *nix getopt style, for .NET. Includes F# support
MIT License
4.53k stars 477 forks source link

How to convert string to string[] #679

Open nasserakhter opened 4 years ago

nasserakhter commented 4 years ago

I have this string: --text "Hello World" --desc "Prints hello world to the screen" Using string.split(' '); splits it on every space including inside the quotes

Is there any function to split this string with respect to the quotes so I can parse it as a string[]?

rmunn commented 4 years ago

CommandLineParser adds a .SplitArgs() extension method to strings that's supposed to handle quoting for you. It should be available as long as you have a using CommandLineParser statement in your source file. Give that a try.