From subsecret
(Created page with "=String Splitter (Bash Compatible)= When needing to parse a string into arguments many simply use String.split(" ");. However this fails to handle string with quotes, escaped ...") |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=String Splitter | =Bash like String Splitter= | ||
When needing to parse a string into arguments many simply use String.split(" ");. However this fails to handle string with quotes, escaped quotes, and so on. | When needing to parse a string into arguments in Java, many simply use String.split(" ");. However this fails to handle string with quotes, escaped quotes, and so on. | ||
The UNIX Bash shell has a very simply/efficient/meaningful way of splitting program arguments. This simple java class mimics the way UNIX shell splits strings. | The UNIX Bash shell has a very simply/efficient/meaningful way of splitting program arguments. This simple java class mimics the way UNIX shell splits strings. | ||
=Usage= | =Usage= | ||
//Split String into array (bash compatible) | |||
List<String> splitString = StringSplitter.split(...); | List<String> splitString = StringSplitter.split(...); | ||
Latest revision as of 12:41, 2 May 2017
Bash like String Splitter
When needing to parse a string into arguments in Java, many simply use String.split(" ");. However this fails to handle string with quotes, escaped quotes, and so on. The UNIX Bash shell has a very simply/efficient/meaningful way of splitting program arguments. This simple java class mimics the way UNIX shell splits strings.
Usage
//Split String into array (bash compatible) List<String> splitString = StringSplitter.split(...);
Download
Date | Version | File | Description |
---|---|---|---|
29. December 2013 | 1.00 | http://files.subsecret.dk/StringSplitter100.zip | Initial release |
License
No license. Do whatever you want with it.