UCE Docs / StringList::find

Signature

template String StringList::find(F f, String fallback = "") const

Parameters

f : predicate called with each string
fallback : value returned when no item matches
return value : the first matching string, or fallback

Returns the first string in the list that satisfies the predicate. Use it when you need the matching value itself, not just a yes/no answer, and when a clear fallback is better than a separate missing-value branch.

Example

StringList routes = split("dashboard,index,themes", ",");
String route = routes.find([](String item) { return(str_starts_with(item, "them")); }, "missing");
print(route, "\n");
Output
themes