aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/functions-string.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-11-03 13:08:48 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-11-04 08:09:42 +0200
commit10e634e64b5fffaf19778d8fd3aa854118aa0d53 (patch)
tree99d09d1ae6a7024b7dbc6c436bf1bc780640fe16 /libbuild2/functions-string.cxx
parente612a49ef95cf9ce3d0b5496d724f73cae9aa333 (diff)
Add $size() function to get size of sequence (names, strings, etc)
Diffstat (limited to 'libbuild2/functions-string.cxx')
-rw-r--r--libbuild2/functions-string.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/libbuild2/functions-string.cxx b/libbuild2/functions-string.cxx
index 6e39c44..18a4ed6 100644
--- a/libbuild2/functions-string.cxx
+++ b/libbuild2/functions-string.cxx
@@ -77,6 +77,12 @@ namespace build2
return names {name (ucase (convert<string> (move (s))))};
};
+ // $size(<strings>)
+ //
+ // Return the number of elements in the sequence.
+ //
+ f["size"] += [] (strings v) {return v.size ();};
+
// $sort(<strings> [, <flags>])
//
// Sort strings in ascending order.