diff options
| author | Maxime Coste <mawww@kakoune.org> | 2020-05-19 17:16:37 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2020-05-19 17:16:37 +1000 |
| commit | af175d2e7e8b32f5519aac6992ba337aaaff6361 (patch) | |
| tree | a362cb5465914915b786edf0c7550f2a0b508b09 /src/string_utils.cc | |
| parent | 5933ab1e780f8f2a51f6580e6fad249beea31698 (diff) | |
Output debug memory stats in a nice table
Diffstat (limited to 'src/string_utils.cc')
| -rw-r--r-- | src/string_utils.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/string_utils.cc b/src/string_utils.cc index 3ce98940..2ae8ea6f 100644 --- a/src/string_utils.cc +++ b/src/string_utils.cc @@ -111,6 +111,16 @@ String replace(StringView str, StringView substr, StringView replacement) return res; } +String left_pad(StringView str, ColumnCount size, Codepoint c) +{ + return String(c, std::max(0_col, size - str.column_length())) + str.substr(0, size); +} + +String right_pad(StringView str, ColumnCount size, Codepoint c) +{ + return str.substr(0, size) + String(c, std::max(0_col, size - str.column_length())); +} + Optional<int> str_to_int_ifp(StringView str) { bool negative = not str.empty() and str[0] == '-'; |
