mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug Fix - split
- Fixed bug in split functions, which was causing empty strings to be split into a single element list consisting of one empty string. The symptom was that all tasks without tags appeared to have one zero-length tag and the task was colored according to color.tagged.
This commit is contained in:
parent
01b3cb190c
commit
096a4b9bdb
1 changed files with 6 additions and 2 deletions
|
@ -54,6 +54,7 @@ void split (
|
|||
const std::string& input,
|
||||
const char delimiter)
|
||||
{
|
||||
results.clear ();
|
||||
std::string::size_type start = 0;
|
||||
std::string::size_type i;
|
||||
while ((i = input.find (delimiter, start)) != std::string::npos)
|
||||
|
@ -62,6 +63,7 @@ void split (
|
|||
start = i + 1;
|
||||
}
|
||||
|
||||
if (input.length ())
|
||||
results.push_back (input.substr (start, std::string::npos));
|
||||
}
|
||||
|
||||
|
@ -71,6 +73,7 @@ void split (
|
|||
const std::string& input,
|
||||
const std::string& delimiter)
|
||||
{
|
||||
results.clear ();
|
||||
std::string::size_type length = delimiter.length ();
|
||||
|
||||
std::string::size_type start = 0;
|
||||
|
@ -81,6 +84,7 @@ void split (
|
|||
start = i + length;
|
||||
}
|
||||
|
||||
if (input.length ())
|
||||
results.push_back (input.substr (start, std::string::npos));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue