Previous: unescape, Up: Strings


4.29 unquote

remove quotes from a string

Synopsis

     #include <suplib/str.h>
     
     
     
char *unquote(char *string);

Parameters

char *string
the string to unquote

Description

unquote removes pairs of quotes from a string. The first quote need not be at the beginning of the string. It makes the changes in-place. For example, ‘foo" "bar’ is turned into ‘foo bar’, just like in a UNIX shell. It can deal with either single (forward or backward) or double quotes, and understands escaped characters (with ‘\’ as the escape prefix).

Returns

It returns a pointer to the original string upon success, NULL if the quotes were unbalanced or an escape prefix occurred without a character to escape.

Author

Diab Jerius