ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. utfLen

Function

utfLen

Server and clientUtilitiesIdentical to MTA:SA

Returns the length of a text in characters (not bytes). Important for non-ASCII letters: #"żółw" is 7 bytes, while utfLen("żółw") is 4.

Syntax

int utfLen(string input)

Arguments

inputstring
The text.

Returns

Number of characters, or false for invalid UTF-8.

Example

addEventHandler("onPlayerChat", root, function(message)
    if utfLen(message) > 120 then cancelEvent() outputChatBox("Za dluga wiadomosc", source) end
end)

See also