.len()
Published Jul 5, 2024
Contribute to Docs
The .len()
method returns the total number of characters present in a specified string.
Syntax
string.len(s)
s
: The input string whose length is to be determined.
Note: Calling
string.len()
without any arguments will result in an error.
Example
The following example demonstrates the usage of the .len()
method:
town = "Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch"lenExample = string.len(town)print(lenExample)
The above code produces the following output:
58
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.