mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Text
- More polymorphic formatting.
This commit is contained in:
parent
8de2a1030e
commit
d8691bc993
2 changed files with 34 additions and 0 deletions
32
src/text.cpp
32
src/text.cpp
|
@ -851,6 +851,22 @@ const std::string format (
|
|||
return output;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
const std::string format (
|
||||
const std::string& fmt,
|
||||
int arg1,
|
||||
const std::string& arg2,
|
||||
const std::string& arg3,
|
||||
const std::string& arg4)
|
||||
{
|
||||
std::string output = fmt;
|
||||
replace_positional (output, "{1}", format (arg1));
|
||||
replace_positional (output, "{2}", arg2);
|
||||
replace_positional (output, "{3}", arg3);
|
||||
replace_positional (output, "{4}", arg4);
|
||||
return output;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
const std::string format (
|
||||
const std::string& fmt,
|
||||
|
@ -919,6 +935,22 @@ const std::string format (
|
|||
return output;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
const std::string format (
|
||||
const std::string& fmt,
|
||||
const std::string& arg1,
|
||||
const std::string& arg2,
|
||||
const std::string& arg3,
|
||||
const std::string& arg4)
|
||||
{
|
||||
std::string output = fmt;
|
||||
replace_positional (output, "{1}", arg1);
|
||||
replace_positional (output, "{2}", arg2);
|
||||
replace_positional (output, "{3}", arg3);
|
||||
replace_positional (output, "{4}", arg4);
|
||||
return output;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string leftJustify (const int input, const int width)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue