WoW:API strlen

From AddOn Studio
Revision as of 04:47, 15 August 2023 by Move page script (talk | contribs) (Move page script moved page API strlen to API strlen without leaving a redirect)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

WoW Lua

Return the length, in bytes, of the string passed.

string.len(s)
strlen(s)

Examples

s = "Lua" 
print(string.len("Lua"), s:len(), #s) -- 3,3,3; the three methods are equivalent
print(string.len("Lua\000user"))   -- 8: Lua strings are 8 bit pure so \000 does not terminate

See also

  • strlenutf8 - for utf8-aware string length parsing.