StrLen() / StringLen

AutoHotkey GUI

StrLen() / StringLen

Retrieves the count of how many characters are in a string.

StrLen()

Length := StrLen(String)

Parameters

String

The string to be measured.

Return Value

This function returns the length of the string.

Examples

InputVar := "The Quick Brown Fox Jumps Over the Lazy Dog"
MsgBox % "The length of InputVar is " . StrLen(InputVar) ; Result: 43

StringLen

Deprecated: This command is not recommended for use in new scripts. Use the StrLen function instead.

StringLen, OutputVar, InputVar

Parameters

OutputVar

The name of the variable in which to store the length.

InputVar

The name of the variable whose contents will be measured. Do not enclose the name in percent signs unless you want the contents of the variable to be used as the name.

Examples

StringLen, Length, InputVar
MsgBox, The length of InputVar is %Length%.

Remarks

If String or InputVar is a variable to which ClipboardAll was previously assigned, StrLen() or StringLen will report its total size.

Related

IfInString, StringGetPos, StringMid, StringTrimLeft, StringTrimRight, StringLeft, StringRight, StringLower, StringUpper, StringReplace