From 0ae2c768fc8b2e43d271284544af35a27dc2cd17 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 6 Jun 2022 11:27:32 +0200 Subject: Add trim_left() and trim_right() in addition to trim() Also improve the trim() implementation. --- libbutl/utility.hxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'libbutl/utility.hxx') diff --git a/libbutl/utility.hxx b/libbutl/utility.hxx index 49b61b3..95a7f78 100644 --- a/libbutl/utility.hxx +++ b/libbutl/utility.hxx @@ -146,12 +146,30 @@ namespace butl LIBBUTL_SYMEXPORT std::string& trim (std::string&); + LIBBUTL_SYMEXPORT std::string& + trim_left (std::string&); + + LIBBUTL_SYMEXPORT std::string& + trim_right (std::string&); + inline std::string trim (std::string&& s) { return move (trim (s)); } + inline std::string + trim_left (std::string&& s) + { + return move (trim_left (s)); + } + + inline std::string + trim_right (std::string&& s) + { + return move (trim_right (s)); + } + // Find the beginning and end poistions of the next word. Return the size // of the word or 0 and set b = e = n if there are no more words. For // example: -- cgit v1.1