Capy-Bearer Documentation

Filter strings

lib call

Capy

function filter(items : dval, predicate : function(value : string) bool) dval

Description

filter keeps the strings for which predicate returns true.

The result keeps input order. This function does not change items.

Return Values

This function returns a new list-shaped dval.

Example

Capy

var items := split("one,two", ",")
var kept := filter(items, function(value : string) bool { return value == "two" })
print(join(kept, ","), "\n")