Hi guys my question is how can I search in an string using loops. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hi guys my question is how can I search in an string using loops.

For example I want to check whether "world "is in "hello world" or no . How can i do this with loops?

26th Mar 2019, 11:02 AM
Daniel
Daniel - avatar
1 Answer
0
First, assign each character to the elements of an array. Then all elements of world to another. Then compare them one by one. If you get the first character, use another if to compare the second character and so on. This process is easy but lengthy.
27th Mar 2019, 6:43 AM
Anshumaan Mishra