The length method returns the length of the provided string.
length(S::AbstractString)
This method takes the String as an argument.
This method returns an Integer value denoting the length of the provided String.
The code below demonstrates the use of the length method:
# Using length method to get length of "Educative"println(length("Educative"))# Using length method to get length of empty stringprintln(length(""))
In the code above:
Line 2:. We use the length method to get the length of the String "Educative". We get 9 as the return value.
Line 5:. We use the length method to get the length of an Empty String "". We get 0 as the return value.