Home › Overview › MainModule › Util
String
Functions
escapePattern
String.escapePattern(s: string): stringEscape magic string pattern characters: % . ( ) [ ] + - * ? ^ $
escapeRichText
String.escapeRichText(s: string): stringEscape RichText tags
unescapeRichText
String.unescapeRichText(s: string): stringUnescape RichText tags
levenshteinDistance
String.levenshteinDistance(s1: string, s2: string): numberCalculates the Levenshtein distance between two strings.
splitOutsideQuotes
String.splitOutsideQuotes(text: string, delimiter: string?): { string }?Splits a string by a specified delimiter, but does not split within quoted sequences.
stripQuotes
String.stripQuotes(s: string): stringStrip enclosing quotes from a string
trimStart
String.trimStart(s: string): stringStrip whitespace from the start of a string
trimEnd
String.trimEnd(s: string): stringStrip whitespace from the end of a string
trim
String.trim(s: string): stringStrip whitespace from both ends of a string
filterResult Yields
String.filterResult(message: string, fromUserId: number, filterContext: Enum.TextFilterContext?): (boolean, TextFilterResult | string)Returns a TextFilterResult with [TextService.FilterStringAsync] to be used with String.filterResultForBroadcast or String.filterResultForUser
filterResultForBroadcast Yields
String.filterResultForBroadcast(filterResult: TextFilterResult | string, fromUserId: number): stringFilters a TextFilterResult for broadcast messages with [TextService.FilterStringAsync]
filterResultForUser Yields
String.filterResultForUser(filterResult: TextFilterResult | string, fromUserId: number, toUserId: number): stringFilters a TextFilterResult for non-chat text shown to a specific user with [TextService.FilterStringAsync]
filterForBroadcast Yields
String.filterForBroadcast(message: string, fromUserId: number, filterContext: Enum.TextFilterContext?): stringFilters a broadcast message with [TextService.FilterStringAsync]
filterForUser Yields
String.filterForUser(message: string, fromUserId: number, toUserId: number, filterContext: Enum.TextFilterContext?): stringFilters a chat message with [TextService.FilterStringAsync]
toFlag
String.toFlag(locale: string): stringConverts a locale string (e.g., "US") to a flag emoji representation, or an empty string if the locale is invalid.