mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-03 06:41:14 -03:00
Add overload of wcstringutil::trim that automatically trims whitespace
This commit is contained in:
@@ -46,6 +46,10 @@ wcstring truncate(const wcstring &input, int max_len, ellipsis_type etype) {
|
||||
return output;
|
||||
}
|
||||
|
||||
wcstring trim(const wcstring &input) {
|
||||
return trim(input, whitespace.c_str());
|
||||
}
|
||||
|
||||
wcstring trim(const wcstring &input, const wchar_t *any_of) {
|
||||
auto begin_offset = input.find_first_not_of(any_of);
|
||||
if (begin_offset == wcstring::npos) {
|
||||
|
||||
@@ -64,6 +64,7 @@ enum class ellipsis_type {
|
||||
};
|
||||
|
||||
wcstring truncate(const wcstring &input, int max_len, ellipsis_type etype = ellipsis_type::Prettiest);
|
||||
wcstring trim(const wcstring &input);
|
||||
wcstring trim(const wcstring &input, const wchar_t *any_of);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user