mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
File Import
- Implemented all remaining import functionality.
This commit is contained in:
parent
5f4563af2f
commit
25425614b1
6 changed files with 354 additions and 22 deletions
17
src/text.cpp
17
src/text.cpp
|
@ -127,12 +127,19 @@ std::string trim (const std::string& in, const std::string& t /*= " "*/)
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Remove enclosing balanced quotes. Assumes trimmed text.
|
||||
void unquoteText (std::string& text)
|
||||
std::string unquoteText (const std::string& input)
|
||||
{
|
||||
char quote = text[0];
|
||||
if (quote == '\'' || quote == '"')
|
||||
if (text[text.length () - 1] == quote)
|
||||
text = text.substr (1, text.length () - 3);
|
||||
std::string output = input;
|
||||
|
||||
if (output.length () > 1)
|
||||
{
|
||||
char quote = output[0];
|
||||
if ((quote == '\'' || quote == '"') &&
|
||||
output[output.length () - 1] == quote)
|
||||
return output.substr (1, output.length () - 2);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue