Skip to content

String ​

Functions ​

escapePattern ​

luau
String.escapePattern(s: string): string

Escape magic string pattern characters: % . ( ) [ ] + - * ? ^ $

escapeRichText ​

luau
String.escapeRichText(s: string): string

Escape RichText tags

unescapeRichText ​

luau
String.unescapeRichText(s: string): string

Unescape RichText tags

levenshteinDistance ​

luau
String.levenshteinDistance(s1: string, s2: string): number

Calculates the Levenshtein distance between two strings.

splitOutsideQuotes ​

luau
String.splitOutsideQuotes(text: string, delimiter: string?): { string }?

Splits a string by a specified delimiter, but does not split within quoted sequences.

stripQuotes ​

luau
String.stripQuotes(s: string): string

Strip enclosing quotes from a string

trimStart ​

luau
String.trimStart(s: string): string

Strip whitespace from the start of a string

trimEnd ​

luau
String.trimEnd(s: string): string

Strip whitespace from the end of a string

trim ​

luau
String.trim(s: string): string

Strip whitespace from both ends of a string

filterResult Yields ​

luau
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 ​

luau
String.filterResultForBroadcast(filterResult: TextFilterResult | string, fromUserId: number): string

Filters a TextFilterResult for broadcast messages with [TextService.FilterStringAsync]

filterResultForUser Yields ​

luau
String.filterResultForUser(filterResult: TextFilterResult | string, fromUserId: number, toUserId: number): string

Filters a TextFilterResult for non-chat text shown to a specific user with [TextService.FilterStringAsync]

filterForBroadcast Yields ​

luau
String.filterForBroadcast(message: string, fromUserId: number, filterContext: Enum.TextFilterContext?): string

Filters a broadcast message with [TextService.FilterStringAsync]

filterForUser Yields ​

luau
String.filterForUser(message: string, fromUserId: number, toUserId: number, filterContext: Enum.TextFilterContext?): string

Filters a chat message with [TextService.FilterStringAsync]

toFlag ​

luau
String.toFlag(locale: string): string

Converts a locale string (e.g., "US") to a flag emoji representation, or an empty string if the locale is invalid.