UCE Docs / filter

Signature

StringList filter(StringList items, function f)
vector filter(vector items, function f)

Parameters

items : list of items to be filtered
f : predicate function; items are kept when this returns true
return value : a new list

Returns a new list containing the members of items for which f returned true.

Example

StringList names = split("ada,bob,amy", ",");
StringList a_names = filter(names, [](String item) { return(str_starts_with(item, "a")); });
print(join(a_names, ","), "\n");
Output
ada,amy