mirror of
https://github.com/mapnik/mapnik.git
synced 2026-02-01 17:36:36 +00:00
add specialized quote trimming functions (will be used in sql_utils.hpp)
This commit is contained in:
parent
85dc3413e5
commit
815b79a80a
@ -68,6 +68,29 @@ static inline std::string trim_copy(std::string s)
|
||||
return ltrim(rtrim(s));
|
||||
}
|
||||
|
||||
static inline bool not_double_quote(int ch)
|
||||
{
|
||||
if (ch == '"') return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void unquote_double(std::string & s)
|
||||
{
|
||||
s.erase(s.begin(), std::find_if(s.begin(), s.end(), not_double_quote));
|
||||
s.erase(std::find_if(s.rbegin(), s.rend(), not_double_quote).base(), s.end());
|
||||
}
|
||||
|
||||
static inline bool not_quoted(int ch)
|
||||
{
|
||||
if (ch == '"' || ch == '\'') return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void unquote(std::string & s)
|
||||
{
|
||||
s.erase(s.begin(), std::find_if(s.begin(), s.end(), not_quoted));
|
||||
s.erase(std::find_if(s.rbegin(), s.rend(), not_quoted).base(), s.end());
|
||||
}
|
||||
|
||||
}} // end of namespace mapnik
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user