added escape quote method
This commit is contained in:
parent
348d1994ac
commit
b977136904
|
@ -321,6 +321,19 @@ std::string cmSystemTools::EscapeSpaces(const char* str)
|
|||
#endif
|
||||
}
|
||||
|
||||
std::string cmSystemTools::EscapeQuotes(const char* str)
|
||||
{
|
||||
std::string result = "";
|
||||
for(const char* ch = str; *ch != '\0'; ++ch)
|
||||
{
|
||||
if(*ch == '"')
|
||||
{
|
||||
result += '\\';
|
||||
}
|
||||
result += *ch;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// return true if the file exists
|
||||
bool cmSystemTools::FileExists(const char* filename)
|
||||
|
|
|
@ -78,6 +78,12 @@ public:
|
|||
*/
|
||||
static std::string EscapeSpaces(const char*);
|
||||
|
||||
/**
|
||||
* Return a string equivalent to the input string, but with all " replaced
|
||||
* with \" to escape the quote
|
||||
*/
|
||||
static std::string EscapeQuotes(const char*);
|
||||
|
||||
/**
|
||||
* Return a capitalized string (i.e the first letter is uppercased, all other
|
||||
* are lowercased).
|
||||
|
|
Loading…
Reference in New Issue