Elpho LogoElpho

string module

Safe string utilities for casing and replacement. Use for formatting replies and embeds.

Overview

The string helpers cover casing, substring checks, and basic replacement. Prefer these over regex for common operations.

API

  • lower(text), upper(text).
  • length(text), includes(text, search).
  • replace(text, search, value).
No regex support—only literal replacements.

Examples

javascript
const string = use("string");
function main() {
const raw = ctx.command && ctx.command.args ? ctx.command.args.join(" ") : "";
const safe = string.replace(raw, "@", "[at]");
ctx.reply("Echo: " + string.upper(safe));
}
javascript
const string = use("string");
function main() {
const name = ctx.user.name;
ctx.reply("Length of your name: " + string.length(name));
}