Skip to main content

String

Functions

escapePattern

String.escapePattern(sstring) → string

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

escapeRichText

String.escapeRichText(sstring) → string

Escape RichText tags

unescapeRichText

String.unescapeRichText(sstring) → string

Unescape RichText tags

levenshteinDistance

String.levenshteinDistance(
s1string,
s2string
) → number

Calculates the Levenshtein distance between two strings.

splitOutsideQuotes

String.splitOutsideQuotes(
textstring,
delimiterstring?
) → {string}?

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

stripQuotes

String.stripQuotes(sstring) → string

Strip enclosing quotes from a string

trimStart

String.trimStart(sstring) → string

Strip whitespace from the start of a string

trimEnd

String.trimEnd(sstring) → string

Strip whitespace from the end of a string

trim

String.trim(sstring) → string

Strip whitespace from both ends of a string

filterResult

String.filterResult(
messagestring,
fromUserIdnumber,
filterContextEnum.TextFilterContext?
) → (
boolean,
)

filterResultForBroadcast

String.filterResultForBroadcast(
filterResultTextFilterResult | string,
fromUserIdnumber
) → ()

Filters a TextFilterResult for broadcast messages with TextService.FilterStringAsync

filterResultForUser

String.filterResultForUser(
filterResultTextFilterResult | string,
fromUserIdnumber,
toUserIdnumber
) → ()

Filters a TextFilterResult for chat messages chat with TextService.FilterStringAsync

filterForBroadcast

String.filterForBroadcast(
messagestring,
fromUserIdnumber,
filterContextEnum.TextFilterContext?
) → string

Filters a broadcast message with TextService.FilterStringAsync

filterForUser

String.filterForUser(
messagestring,
fromUserIdnumber,
toUserIdnumber,
filterContextEnum.TextFilterContext?
) → string

Filters a chat message with TextService.FilterStringAsync

toFlag

String.toFlag(localestring) → string

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

Show raw api
{
    "functions": [
        {
            "name": "escapePattern",
            "desc": "Escape magic string pattern characters: % . ( ) [ ] + - * ? ^ $",
            "params": [
                {
                    "name": "s",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 12,
                "path": "src/Util/String.luau"
            }
        },
        {
            "name": "escapeRichText",
            "desc": "Escape RichText tags",
            "params": [
                {
                    "name": "s",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 17,
                "path": "src/Util/String.luau"
            }
        },
        {
            "name": "unescapeRichText",
            "desc": "Unescape RichText tags",
            "params": [
                {
                    "name": "s",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 27,
                "path": "src/Util/String.luau"
            }
        },
        {
            "name": "levenshteinDistance",
            "desc": "Calculates the Levenshtein distance between two strings.",
            "params": [
                {
                    "name": "s1",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "s2",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 37,
                "path": "src/Util/String.luau"
            }
        },
        {
            "name": "splitOutsideQuotes",
            "desc": "Splits a string by a specified delimiter, but does not split within quoted sequences.",
            "params": [
                {
                    "name": "text",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "delimiter",
                    "desc": "",
                    "lua_type": "string?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ string }?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 70,
                "path": "src/Util/String.luau"
            }
        },
        {
            "name": "stripQuotes",
            "desc": "Strip enclosing quotes from a string",
            "params": [
                {
                    "name": "s",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 109,
                "path": "src/Util/String.luau"
            }
        },
        {
            "name": "trimStart",
            "desc": "Strip whitespace from the start of a string",
            "params": [
                {
                    "name": "s",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 118,
                "path": "src/Util/String.luau"
            }
        },
        {
            "name": "trimEnd",
            "desc": "Strip whitespace from the end of a string",
            "params": [
                {
                    "name": "s",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 123,
                "path": "src/Util/String.luau"
            }
        },
        {
            "name": "trim",
            "desc": "Strip whitespace from both ends of a string",
            "params": [
                {
                    "name": "s",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 128,
                "path": "src/Util/String.luau"
            }
        },
        {
            "name": "filterResult",
            "desc": "Returns a [TextFilterResult] with [TextService.FilterStringAsync] to be used with [String.filterResultForBroadcast] or [String.filterResultForUser]",
            "params": [
                {
                    "name": "message",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "fromUserId",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "filterContext",
                    "desc": "",
                    "lua_type": "Enum.TextFilterContext?\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                },
                {
                    "desc": "",
                    "lua_type": "TextFilterResult | string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 133,
                "path": "src/Util/String.luau"
            }
        },
        {
            "name": "filterResultForBroadcast",
            "desc": "Filters a [TextFilterResult] for broadcast messages with [TextService.FilterStringAsync]",
            "params": [
                {
                    "name": "filterResult",
                    "desc": "",
                    "lua_type": "TextFilterResult | string"
                },
                {
                    "name": "fromUserId",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 144,
                "path": "src/Util/String.luau"
            }
        },
        {
            "name": "filterResultForUser",
            "desc": "Filters a [TextFilterResult] for chat messages chat with [TextService.FilterStringAsync]",
            "params": [
                {
                    "name": "filterResult",
                    "desc": "",
                    "lua_type": "TextFilterResult | string"
                },
                {
                    "name": "fromUserId",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "toUserId",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 159,
                "path": "src/Util/String.luau"
            }
        },
        {
            "name": "filterForBroadcast",
            "desc": "Filters a broadcast message with [TextService.FilterStringAsync]",
            "params": [
                {
                    "name": "message",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "fromUserId",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "filterContext",
                    "desc": "",
                    "lua_type": "Enum.TextFilterContext?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 182,
                "path": "src/Util/String.luau"
            }
        },
        {
            "name": "filterForUser",
            "desc": "Filters a chat message with [TextService.FilterStringAsync]",
            "params": [
                {
                    "name": "message",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "fromUserId",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "toUserId",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "filterContext",
                    "desc": "",
                    "lua_type": "Enum.TextFilterContext?\n"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 188,
                "path": "src/Util/String.luau"
            }
        },
        {
            "name": "toFlag",
            "desc": "Converts a locale string (e.g., \"US\") to a flag emoji representation, or an empty string if the locale is invalid.",
            "params": [
                {
                    "name": "locale",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 202,
                "path": "src/Util/String.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "String",
    "desc": "",
    "source": {
        "line": 9,
        "path": "src/Util/String.luau"
    }
}