aboutsummaryrefslogtreecommitdiff
path: root/libbutl/utility.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-06-06 11:27:32 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-06-06 11:27:32 +0200
commit0ae2c768fc8b2e43d271284544af35a27dc2cd17 (patch)
treedea709cde647c349ff45cf89104603e7a9693467 /libbutl/utility.hxx
parentc1e9c118b890ff59c2971ce12753a655bedcf1c2 (diff)
Add trim_left() and trim_right() in addition to trim()
Also improve the trim() implementation.
Diffstat (limited to 'libbutl/utility.hxx')
-rw-r--r--libbutl/utility.hxx18
1 files changed, 18 insertions, 0 deletions
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: