stringext
luau
local stringext = require("@std/stringext")stringext.count
Counts the number of occurrences of pattern in str, optionally restricted to the range [startPos, endPos].
luau
(str: string, pattern: string, startPos: number?, endPos: number?) -> numberstringext.hasPrefix
Returns true if str begins with prefix.
luau
(str: string, prefix: string) -> booleanstringext.hasSuffix
Returns true if str ends with suffix.
luau
(str: string, suffix: string) -> booleanstringext.removePrefix
Returns str with prefix removed from the front. If str does not start with prefix, returns str unchanged.
luau
(str: string, prefix: string) -> stringstringext.removeSuffix
Returns str with suffix removed from the end. If str does not end with suffix, returns str unchanged.
luau
(str: string, suffix: string) -> stringstringext.trim
Returns str with leading and trailing whitespace removed.
luau
(str: string) -> string