WowAddons

World of Warcraft Forever API · C_StringUtil.md, for your AI

C_StringUtil

14 functions, 1 tables, as Blizzard documents them for Forever 1.60.1 (70959).

Making an addon with an AI? Tell it: Read https://wowaddons.gg/agents.md, then make me a World of Warcraft Forever addon that …, try it with me in the game, and publish it. It checks every call against this API before you try it in the game, then publishes it here. How it works.

Functions

C_StringUtil.CreateAbbreviatedNumberFormatter

formatter = C_StringUtil.CreateAbbreviatedNumberFormatter()

Creates a numeric formatter that converts numbers to abbreviated strings, eg. 123456 -> '123k'.

Returns

formatterAbbreviatedNumberFormatter

C_StringUtil.CreateNumericRuleFormatter

formatter = C_StringUtil.CreateNumericRuleFormatter()

Creates a numeric formatter that converts numbers to strings with flexible rulesets.

Returns

formatterNumericRuleFormatter

C_StringUtil.CreateSecondsFormatter

formatter = C_StringUtil.CreateSecondsFormatter()

Creates a numeric formatter that converts numbers measuring durations in seconds to strings, eg. 93 -> '1m 33s'.

Returns

formatterSecondsFormatter

C_StringUtil.EscapeDecimalNonPrintables

escapedText = C_StringUtil.EscapeDecimalNonPrintables(text)

Returns a string with ASCII control characters (except , , and ) and invalid UTF-8 bytes replaced by decimal escape sequences (e.g. \127).

Arguments

textstringView

Returns

escapedTextstring

C_StringUtil.EscapeLuaFormatString

escapedText = C_StringUtil.EscapeLuaFormatString(text)

Returns a string with Lua format string tokens ('%') escaped.

Arguments

textstring

Returns

escapedTextstringView

C_StringUtil.EscapeLuaPatterns

escapedText = C_StringUtil.EscapeLuaPatterns(text)

Returns a string with all Lua pattern characters escaped.

Arguments

textstringView

Returns

escapedTextstring

C_StringUtil.EscapeQuotedCodes

escaped = C_StringUtil.EscapeQuotedCodes(text)

Returns a string with all quoted code sequences ('|' characters) escaped.

Arguments

textstring

Returns

escapedstringView

C_StringUtil.FloorToNearestString

text = C_StringUtil.FloorToNearestString(number)

Arguments

numbernumber

Returns

textstring

C_StringUtil.RemoveContiguousSpaces

trimmedText = C_StringUtil.RemoveContiguousSpaces(text, maxAllowedSpaces)

Returns a string with all contiguous occurrences of ASCII space characters truncated.

Arguments

textstringView
maxAllowedSpacesnumberMaximum number of permitted contiguous space characters; excessive spaces will be truncated to this count.

Returns

trimmedTextstring

C_StringUtil.RoundToNearestString

text = C_StringUtil.RoundToNearestString(number)

Arguments

numbernumber

Returns

textstring

C_StringUtil.StripTextureMarkupForLooseFiles

stripped = C_StringUtil.StripTextureMarkupForLooseFiles(text)

Arguments

textstring

Returns

strippedstringView

C_StringUtil.TruncateWhenZero

text = C_StringUtil.TruncateWhenZero(number)

Formats the given number to a string as an integer (rounding down). If the integer is zero, returns an empty string.

Arguments

numbernumber

Returns

textstring

C_StringUtil.WrapString

text = C_StringUtil.WrapString(infix, [prefix], [suffix])

Returns a string with 'prefix' and 'suffix' joined to 'infix' iif 'infix' is not an empty string. Else, an empty string is returned.

Arguments

infixstringView
prefixstringView may be nil
suffixstringView may be nil

Returns

textstring

Tables

StripHyperlinkOptions structure

maintainColorbool default falseIf true, preserve all '|c' and '|r' quoted code sequences.
maintainBracketsbool default falseIf true, preserve all '[' and ']' characters.
stripNewlinesbool default falseIf true, remove all '|n' quoted code sequences.
maintainAtlasesbool default falseIf true, preserve all balanced '|A' and '|a' quoted code sequences.
maintainTexturesbool default falseIf true, preserve all balanced '|T' and '|t' quoted code sequences.

It takes WowAddons

Free, for Windows, macOS and Linux: it puts the addon in your game in one click and keeps it up to date. Open it once, then press Install again.

WowAddons runs on your computer: open wowaddons.gg there.

Download for Windows