Math & Text
toLowercase
$toLowercase — Convert to Lowercase
$toLowercase transforms all uppercase characters in a string to their lowercase equivalents. It’s commonly used to normalize user input for case-insensitive comparisons.
Syntax
$toLowercase[text]
Parameters
- text (string, required) — The string to convert.
Return Value
- Type:
string - Returns the input text with all letters converted to lowercase.
- Non-alphabetic characters (numbers, symbols, spaces) remain unchanged.
- Exactly one argument is required (
$toLowercasewithout brackets or with two arguments is refused: “Invalid argument count”);$toLowercase[]returns an empty string.
Usage
$toLowercase[HELLO] → "hello"
$toLowercase[Hello] → "hello"
$toLowercase[123 ABC] → "123 abc"
$toLowercase[$message] → user's message in lowercase
Common Patterns
Case-Insensitive Command Detection
$if[$toLowercase[$splitText[1]]==!ping]
$sendMessage[Pong!]
$endif
This matches !ping, !PING, !Ping, etc.
Normalizing User Input for Storage
$setUserVar[name;$toLowercase[$message]]
Case-Insensitive Keyword Check
$if[$checkContains[$toLowercase[$message];help]==true]
$sendMessage[Here's the help menu...]
$endif
Important Notes
- Not limited to ASCII: accented letters are converted too:
$toLowercase[ÉCOLE]→école. - Only letters: Digits, punctuation, and whitespace pass through unchanged.
- Combine with $replaceText: Use
$toLowercasebefore$replaceTextfor consistent matching.
Examples
Normalizing Text to Lowercase
$title[Lowercase Conversion]
$description[Original: `$message`
Lowercase: **$toLowercase[$message]**]
$color[#5865F2]
Try it
Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.