@assertions:charset!
Whether every byte of the string return of a call is in a character class, checked on-chain — only-lowercase is @charset!(call a-z).
Returns: bool
Syntax
Section titled “Syntax”@assertions:charset!(call class)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
call | address | A :: call expression (or chain) returning a string |
class | string | Allowed characters and ranges, e.g. a-z0-9- (a leading or trailing dash is the literal -) |
Examples
Section titled “Examples”load assertions
set $token 0x44fA8E6f47987339850636F88629646662444217
# The symbol contains only lowercase lettersassertions:assert @charset!($token::{symbol()(string)} "a-z") == true
# An ENS-label-ish name: lowercase, digits and dashesassertions:assert @charset!($token::{name()(string)} "a-z0-9-") == true- The class is characters and
x-yranges; a leading or trailing dash is the literal-. It compiles to a 256-bit byte bitmap at build time — the on-chain check is one bit test per byte. - Byte-level: multi-byte UTF-8 characters (every byte ≥ 0x80) fail any
ASCII-only class, so
a-zreally means lowercase ASCII. - The empty string passes every class — pair with
@len!(call) > 0when the value must also be non-empty. - Boolean-valued: usable bare, compared with
== true/== false, or nested inside@bool!(...)logic.