mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-27 12:16:25 +02:00
Common: Eliminated side-effect version of split
This commit is contained in:
parent
1e6412bcb1
commit
d4d3ec4988
3 changed files with 1 additions and 22 deletions
|
@ -127,8 +127,7 @@ Color::Color (const std::string& spec)
|
|||
: _value (0)
|
||||
{
|
||||
// Split spec into words.
|
||||
std::vector <std::string> words;
|
||||
split (words, spec, ' ');
|
||||
std::vector <std::string> words = split (spec, ' ');
|
||||
|
||||
// Construct the color as two separate colors, then blend them later. This
|
||||
// make it possible to declare a color such as "color1 on black", and have
|
||||
|
|
|
@ -47,25 +47,6 @@ std::vector <std::string> split (const std::string& input, const char delimiter)
|
|||
return results;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void split (
|
||||
std::vector<std::string>& results,
|
||||
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)
|
||||
{
|
||||
results.push_back (input.substr (start, i - start));
|
||||
start = i + 1;
|
||||
}
|
||||
|
||||
if (input.length ())
|
||||
results.push_back (input.substr (start));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
const std::string format (std::string& value)
|
||||
{
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
|
||||
// text.cpp, Non-UTF-8 aware.
|
||||
std::vector <std::string> split (const std::string&, const char);
|
||||
void split (std::vector<std::string>&, const std::string&, const char);
|
||||
const std::string format (std::string&);
|
||||
const std::string format (const char*);
|
||||
const std::string formatHex (int);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue