diff options
-rw-r--r-- | libbuild2/functions-string.cxx | 22 | ||||
-rw-r--r-- | libbuild2/utility.hxx | 1 |
2 files changed, 23 insertions, 0 deletions
diff --git a/libbuild2/functions-string.cxx b/libbuild2/functions-string.cxx index f458a59..c5cb216 100644 --- a/libbuild2/functions-string.cxx +++ b/libbuild2/functions-string.cxx @@ -55,6 +55,28 @@ namespace build2 return names {name (trim (convert<string> (move (s))))}; }; + // Convert ASCII strings into lower/upper case. + // + f["lcase"] = [](string s) + { + return lcase (move (s)); + }; + + f[".lcase"] = [](names s) + { + return names {name (lcase (convert<string> (move (s))))}; + }; + + f["ucase"] = [](string s) + { + return ucase (move (s)); + }; + + f[".ucase"] = [](names s) + { + return names {name (ucase (convert<string> (move (s))))}; + }; + // String-specific overloads from builtins. // function_family b (m, "builtin"); diff --git a/libbuild2/utility.hxx b/libbuild2/utility.hxx index 7dbff2f..369e58b 100644 --- a/libbuild2/utility.hxx +++ b/libbuild2/utility.hxx @@ -66,6 +66,7 @@ namespace build2 using butl::icase_compare_string; using butl::icase_compare_c_string; using butl::lcase; + using butl::ucase; using butl::alpha; using butl::alnum; using butl::digit; |