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

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": 9,
                "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": 14,
                "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": 24,
                "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": 35,
                "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": 79,
                "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": 118,
                "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": 127,
                "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": 132,
                "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": 137,
                "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": 142,
                "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": 153,
                "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": 168,
                "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": 191,
                "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": 197,
                "path": "src/Util/String.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "String",
    "desc": "",
    "source": {
        "line": 6,
        "path": "src/Util/String.luau"
    }
}