---
id: text-contains
name: Text.contains
category: text
kind: namespace-method
tokens: Text.contains
sig: Text.contains(s, sub) -> bool
tip: Whether a substring appears anywhere in a string.
order: 5
ns: Text
member: contains
---
Returns true when sub occurs anywhere inside s. An empty substring is always considered present. Use it for a quick membership test — filtering a log line, checking for a forbidden word, or seeing whether a path includes a folder — when you do not need the position. Reach for Text.index_of when you also want where it matched.
Parameters:
- `s` — the string to search
- `sub` — the substring to look for
```ludic
program Filter {
let line: string = "error: disk full"
handler Scan phase Update {
if Text.contains(line, "error") {
# flag it
}
}
}
```