Get length of a string in Julia – length() Method
The length()
is an inbuilt function in julia which is used to return the length of the specified string with desired starting and end position.
Syntax:
length(S::AbstractString)
or
length(S::AbstractString, i::Integer, j::Integer)
Parameters:
- S::AbstractString: Specified string
- i::Integer: Inclusive starting position.
- i::Integer: Inclusive ending position.
Returns: It returns the length of the specified string with desired starting and end position.
Example 1:
println(length( "Geeks" ))
println(length( "Geeks" , 2 , 4 ))
println(length( "Geeks" , 2 , 5 ))
println(length( "GeeksforGeeks" ))
println(length( "GeeksforGeeks" , 2 , 2 ))
println(length( "GeeksforGeeks" , 4 , 10 ))
|
Output:
Example 2:
println(length( "12345" ))
println(length( "12345" , 2 , 4 ))
println(length( "2468" , 2 , 3 ))
|
Output:
Last Updated :
26 Mar, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...