- function to remove double quotes around the string
This commit is contained in:
@@ -408,3 +408,18 @@ std::string strx::uppercase(const std::string& s)
|
|||||||
std::transform(r.begin(), r.end(), r.begin(), ::toupper);
|
std::transform(r.begin(), r.end(), r.begin(), ::toupper);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string strx::removeQuotes(const std::string& s)
|
||||||
|
{
|
||||||
|
std::string r(s);
|
||||||
|
if (s.empty())
|
||||||
|
return s;
|
||||||
|
|
||||||
|
if (r.front() == '"')
|
||||||
|
r = r.substr(1);
|
||||||
|
|
||||||
|
if (r.back() == '"')
|
||||||
|
r = r.substr(0, r.size()-1);
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ public:
|
|||||||
static bool endsWith(const std::string& s, const std::string& suffix);
|
static bool endsWith(const std::string& s, const std::string& suffix);
|
||||||
static int stringToDuration(const std::string& s);
|
static int stringToDuration(const std::string& s);
|
||||||
static std::string uppercase(const std::string& s);
|
static std::string uppercase(const std::string& s);
|
||||||
|
static std::string removeQuotes(const std::string& s);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user