From 0e1a28e47753f2b4b4d299fa0b3c3ac80c05dc76 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 30 Sep 2019 19:08:53 +0300 Subject: Add support for $string.icasecmp() --- libbuild2/functions-string.cxx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'libbuild2/functions-string.cxx') 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 (move (y))) == 0; + }; + + f["icasecmp"] = [](names x, string y) + { + return icasecmp (convert (move (x)), y) == 0; + }; + + f[".icasecmp"] = [](names x, names y) + { + return icasecmp (convert (move (x)), + convert (move (y))) == 0; + }; + // String-specific overloads from builtins. // function_family b (m, "builtin"); -- cgit v1.1