I am unable to understand what does question ask #substring

#1

``````Find the 4th up to and including the 7th letter
of the string "wonderful day"``````

#2

As you have in the exmple, Lets take the word "Laptop" and find the 4th letter up to 6th(including).

So the word "laptop" has 6 letters.
Lets say we want to find the 3th letter.
To count a substring word, you start by 0 like:
L = 0
a = 1
p = 2
t = 3
o = 4
p = 5

So if you want to find the 4th letter up to the 6th (including) you start from 3 and end with 6 like:

``"laptop".substring(3,6)``

Remember, if you want to start counting from the 3th letter, you put (2,X)
if you want to count from the 6th letter, you put (5,X)

So if you take the word "wonderful day" and want to find the 4th letter up to the 7th(including) you say:

``"wonderful day".substring(3,7)``

I really hope you understand what i wrote lol

#3

thanks funct1on, its functioning .
the mistake i was doing was capital letter W at beginning....
thanks again

#4

So i just told you something you already know? lol
And no problem dude, anytime!

#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.