New Issue: [Feature Request]: Add 'string/bytes.contains'

28302, "jabraham17", "[Feature Request]: Add 'string/bytes.contains'", "2026-01-12T22:42:22Z"

Summary of Feature

Description:
The list type supports both .find and .contains to check if an element is in the list. The former returns the index of the element while the latter is a simple identity check.

The string/bytes types do not support this, they only allow ".find" to check for substrings.

I think it would be good to support ".contains" on string/bytes as a natural way to check if a string contains a given substring. This is more succinct and better expresses intent than "myString.find(mySubstr) != -1". This has bitten me multiple times as I expect .contains to exist, only to be reminded it doesn't

There is a future for this as test/studies/adventOfCode/2021/bradc/futures/day24-stringContains.future.

Is this issue currently blocking your progress?
no

Code Sample

const s = "hello, world";
if s.contains("hello") {
  writeln("its a greeting");
}