Split string with space but ignore when in quotes
Solved
General and Desktop
-
Hi,
I am facing a problem when splitting a string.
Input: /number:123 /alphabets:"Good Morning \"Sam\"" /alphanumeric:" 'A' @ 123 \"abc\"" new open
Expected output:
1- /number:123
2- /alphabets:Good Morning \"Sam\"
3-/alphanumeric: 'A' @ 123 \"abc\"
4-new
5-openCan somebody please help me here?
-
@Maaz-Momin
split also allows for regular expressions
https://doc.qt.io/qt-5/qstring.html#split-3Just a matter of regexp black magic
googles black magic:
https://stackoverflow.com/questions/9577930/regular-expression-to-select-all-whitespace-that-isnt-in-quotes