refactor utils
This commit is contained in:
@@ -11,10 +11,12 @@
|
||||
#include <string_view>
|
||||
#include <utils.hpp>
|
||||
|
||||
namespace utils {
|
||||
|
||||
/* pads given string to length */
|
||||
std::string pad(std::string s, uint8_t len, JUST j) {
|
||||
std::string pad(std::string s, uint8_t len, just j) {
|
||||
if (len > s.size())
|
||||
s.insert(j == JUST::LEFT ? s.end() : s.begin(), len - s.size(), FILL_CHAR);
|
||||
s.insert(j == just::left ? s.end() : s.begin(), len - s.size(), FILL_CHAR);
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -65,3 +67,5 @@ std::string getFirstDir(std::string_view path) {
|
||||
return entry.path();
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user