diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2019-09-30 19:08:53 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-10-01 12:15:10 +0300 |
commit | 0e1a28e47753f2b4b4d299fa0b3c3ac80c05dc76 (patch) | |
tree | 7e575fd7c0ef1eb6a097b6f84934349ce185b2c2 /libbuild2 | |
parent | c478a365d8479ca25f6a72d42ecd45dcb9e9569a (diff) |
Add support for $string.icasecmp()
Diffstat (limited to 'libbuild2')
-rw-r--r-- | libbuild2/functions-string.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libbuild2/functions-string.cxx b/libbuild2/functions-string.cxx index 1e93943..55715fe 100644 --- a/libbuild2/functions-string.cxx +++ b/libbuild2/functions-string.cxx @@ -21,6 +21,29 @@ namespace build2 // // f["string"] = [](strings v) {return v;}; + // Compare ASCII strings ignoring case and returning the boolean value. + // + f["icasecmp"] = [](string x, string y) + { + return icasecmp (x, y) == 0; + }; + + f["icasecmp"] = [](string x, names y) + { + return icasecmp (x, convert<string> (move (y))) == 0; + }; + + f["icasecmp"] = [](names x, string y) + { + return icasecmp (convert<string> (move (x)), y) == 0; + }; + + f[".icasecmp"] = [](names x, names y) + { + return icasecmp (convert<string> (move (x)), + convert<string> (move (y))) == 0; + }; + // String-specific overloads from builtins. // function_family b (m, "builtin"); |