aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-09-28 12:20:40 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-09-28 12:20:40 +0200
commite6d5f9148dea1a1a69d728056e9695e14f0fb050 (patch)
treee703f2acba21327d1c9697731322e6b08e98c77d /libbuild2
parent482d28f130511e7ce5f94dfcb03e020b4e1d9831 (diff)
Add $string.trim() function
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/functions-string.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/libbuild2/functions-string.cxx b/libbuild2/functions-string.cxx
index da4fe02..f458a59 100644
--- a/libbuild2/functions-string.cxx
+++ b/libbuild2/functions-string.cxx
@@ -43,6 +43,18 @@ namespace build2
convert<string> (move (y))) == 0;
};
+ // Trim.
+ //
+ f["trim"] = [](string s)
+ {
+ return trim (move (s));
+ };
+
+ f[".trim"] = [](names s)
+ {
+ return names {name (trim (convert<string> (move (s))))};
+ };
+
// String-specific overloads from builtins.
//
function_family b (m, "builtin");