Garry's Mod Wiki

string.len

  number string.len( string str )

Description

Counts the number of characters in the string (length). This is equivalent to using the length operator (#).

Arguments

1 string str
The string to find the length of.

Returns

1 number
Length of the string

Example

Demonstrates the use of this function.

print( string.len( "hi" ) ) print( string.len( "drakehawke" ) ) print( string.len( "" ) ) print( string.len( "test" ) == #"test" )
Output:

2

10

0

true