@lang:str.includes
Check whether a string contains a substring (exact byte sequence, case-sensitive).
On-chain (@lang:str.includes!): The substring may be a live call; a constant one must be non-empty, since every string contains the empty string.
Returns: bool
Syntax
Section titled “Syntax”@lang:str.includes(value item)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
value | string | Source string |
item | string | Substring to search for |
See Also
Section titled “See Also”- @str.replace — find and replace
- @includes — array membership check
On-chain face (@str.includes!)
Section titled “On-chain face (@str.includes!)”Whether the string return of a call contains a substring, checked on-chain — exact byte sequence, case-sensitive, no wildcards.
Examples
Section titled “Examples”load lang
set $pool 0x44fA8E6f47987339850636F88629646662444217
# "Uniswap LP Token" contains "LP"assert @str.includes!($pool::{name()(string)} "LP") == true
# The name must NOT mention a rebrandassert @str.includes!($pool::{name()(string)} "Sushi") == false- An empty
partis rejected at build time when it is a constant — every string contains it, so the assertion could never fail. A LIVE part that resolves empty reports found at 0, which is the same answer stated honestly rather than a guard that cannot run. - Matches the exact byte sequence: case-sensitive, no wildcards or regex; a
multi-byte UTF-8
partmatches its exact encoding. - Boolean-valued: usable bare, compared with
== true/== false, or nested inside@bool!(...)logic.
See Also
Section titled “See Also”assert,@str.charset!,@str.split!