WoW:API strlen: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Use Lua/Libshortcut template. Change category from "LUA Functions" to "Lua functions".)
m (Move page script moved page API strlen to API strlen without leaving a redirect)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{:Lua/Libshortcut|strlen|string.len}}
{{luaapi}}
Return the length, in bytes, of the string passed.
  string.len(s)
  string.len(s)
strlen(s)


Return the length of the string passed.
== 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


> = string.len("Lua")
== See also ==
3
* {{api|strlenutf8}} - for utf8-aware string length parsing.
> = string.len("")
0
> = string.len("Lua\000user")  -- Lua strings are 8 bit pure so \000 does not terminate
8
 
 
{{LUA}}

Latest revision as of 04:47, 15 August 2023

WoW Lua

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

string.len(s)
strlen(s)

Examples[edit]

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[edit]

  • strlenutf8 - for utf8-aware string length parsing.