python's shlex alternative for C/C++ [closed]

不打扰是莪最后的温柔 提交于 2019-12-05 02:24:08

问题


Simple question - is there something like python's shlex package that would allow me to simply parse/split/quote/escape shell-like quoted/backslashed strings in C or (possibly) C++?

The shlex package is just wonderful with its purpose (giving easy births to minilanguages and stuff), having similar common processing tool in C would be nice.

Link to shlex docs: http://docs.python.org/3.4/library/shlex.html

Example of what shlex does:

>>> import shlex
>>> shlex.split('abc ab\\ c  "ab\\"cd" key="\\"val\\""')
['abc', 'ab c', 'ab"cd', 'key="val"']

来源:https://stackoverflow.com/questions/21959706/pythons-shlex-alternative-for-c-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!