mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
String length by #1742
This commit is contained in:
parent
b3b5ece63c
commit
5affe64801
@ -119,6 +119,9 @@ b == a # => True, a's and b's objects are equal
|
|||||||
# A string can be treated like a list of characters
|
# A string can be treated like a list of characters
|
||||||
"This is a string"[0] # => 'T'
|
"This is a string"[0] # => 'T'
|
||||||
|
|
||||||
|
# You can find the length of a string
|
||||||
|
len("This is a string") # => 16
|
||||||
|
|
||||||
# .format can be used to format strings, like this:
|
# .format can be used to format strings, like this:
|
||||||
"{} can be {}".format("Strings", "interpolated") # => "Strings can be interpolated"
|
"{} can be {}".format("Strings", "interpolated") # => "Strings can be interpolated"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user