cecntering func
This commit is contained in:
@@ -18,6 +18,13 @@ std::string pad(std::string s, uint8_t len, bool ljust) {
|
||||
return s;
|
||||
}
|
||||
|
||||
// returns the string centered within given length
|
||||
std::string center(std::string str, uint8_t len) {
|
||||
uint8_t padding = len - str.size();
|
||||
str.insert(str.begin(), padding / 2, FILL_CHAR);
|
||||
str.insert(str.end(), padding / 2, FILL_CHAR);
|
||||
return str;
|
||||
}
|
||||
|
||||
// converts large number in (k)bytes to human readable numer with suffix and sane decimal
|
||||
std::string pBytes(double bytes, bool isKbytes) {
|
||||
@@ -77,4 +84,3 @@ std::string getFirstDir(std::string path) {
|
||||
return entry.path();
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user