]> git.ipfire.org Git - thirdparty/asterisk.git/commit
utils: Create ast_strsep function that ignores separators inside quotes
authorGeorge Joseph <george.joseph@fairview5.com>
Thu, 18 Sep 2014 19:21:56 +0000 (19:21 +0000)
committerGeorge Joseph <george.joseph@fairview5.com>
Thu, 18 Sep 2014 19:21:56 +0000 (19:21 +0000)
commitdb6b5c24cd154a3b5e37170280d672f6e79acb5b
tree0bb80ee9af96c39b5674176d671b220fd03d5b53
parent419bb8018c1fa5680b9d28a5a2ea648dce68766f
utils: Create ast_strsep function that ignores separators inside quotes

This function acts like strsep with three exceptions...
* The separator is a single character instead of a string.
* Separators inside quotes are treated literally instead of like separators.
* You can elect to have leading and trailing whitespace and quotes
stripped from the result and have '\' sequences unescaped.

Like strsep, ast_strsep maintains no internal state and you can call it
recursively using different separators on the same storage.

Also like strsep, for consistent results, consecutive separators are not
collapsed so you may get an empty string as a valid result.

Tested by: George Joseph
Review: https://reviewboard.asterisk.org/r/3989/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@423476 65c4cc65-6c06-0410-ace0-fbb531ad65f3
include/asterisk/strings.h
main/utils.c
tests/test_strings.c