refactor utils

This commit is contained in:
2025-12-28 19:55:38 +01:00
parent 2d3a481638
commit c7e2447932
6 changed files with 71 additions and 59 deletions

View File

@@ -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 "";
}
}