StrLen

From ZDoom Wiki
Jump to: navigation, search

int StrLen (str string)

Usage

Returns the length of the string specified by string. Note that all strings in ACS are static, i.e. they are not created on the fly, so it is not really necessary to use this function unless you have a lot of strings stored in a library somewhere — like in Daedalus — and you need to have proper delays for a HudMessage. The existence of StrParam makes this function more useful, however.

Parameters

  • string: The string whose length we want to know.

Return value

Length (the count of the characters) of the given string.

Examples

This script prints a string and its length:

script 1 (void)
{
    str thestring = "This is the string.";

    Print (s:thestring, i:StrLen (thestring));
}