Need help. Why i am not getting the result what wrong in this Code help me plz i am tiredd so much working from last 4 hours. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Need help. Why i am not getting the result what wrong in this Code help me plz i am tiredd so much working from last 4 hours.

https://code.sololearn.com/cg0xc4MTcwtp/?ref=app When i enterd random string and word to search in string i didnt get any result why? Kindly help plz ..

21st Nov 2019, 7:29 PM
Abdul Wahab
Abdul Wahab - avatar
31 Answers
+ 1
Try to check everything
23rd Nov 2019, 12:25 PM
Icibo Beatrice
Icibo Beatrice - avatar
21st Nov 2019, 8:10 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 4
Use indexOf method to acheive that.. unless you want scratch logic to get it done
21st Nov 2019, 8:26 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 2
User defined Package compilation need different commands, i think here it may not work. Remove package statement. And it works.. But what you are trying is not understandable to me.. Where s.length()-word.length() ?
21st Nov 2019, 7:47 PM
Jayakrishna 🇮🇳
21st Nov 2019, 8:03 PM
Jayakrishna 🇮🇳
+ 1
What are you trying to do? Can't work it out from your code sorry.
21st Nov 2019, 8:04 PM
rodwynnejones
rodwynnejones - avatar
+ 1
if(sent.indexOf(word) != -1){ "do what you like in here" }
21st Nov 2019, 8:16 PM
rodwynnejones
rodwynnejones - avatar
21st Nov 2019, 8:45 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 1
Abdul Wahab updated Check out this... Is this what you want? https://code.sololearn.com/cDe9rdB11dha/?ref=app
21st Nov 2019, 9:16 PM
Jayakrishna 🇮🇳
+ 1
Abdul Wahab i checked that also and updated also after a few minutes only.. Did you checked that..?
22nd Nov 2019, 9:08 AM
Jayakrishna 🇮🇳
+ 1
Abdul Wahab wel come
22nd Nov 2019, 7:41 PM
Jayakrishna 🇮🇳
+ 1
Did you check the code? If you need copy that .. I may be deletes it..
22nd Nov 2019, 7:48 PM
Jayakrishna 🇮🇳
+ 1
Yeah i copied it thanks
22nd Nov 2019, 7:49 PM
Abdul Wahab
Abdul Wahab - avatar
0
wet water ))) there nothing to do with tht uppercase Sent cux Sent is used in Main function and other small sent is used in userdefined function i dont think thts the error!!
21st Nov 2019, 7:47 PM
Abdul Wahab
Abdul Wahab - avatar
0
Can u figured it out whts the error plz
21st Nov 2019, 7:48 PM
Abdul Wahab
Abdul Wahab - avatar
0
Jaya krishna s.length- word.length. if i not used this i will get indexoutofbound error
21st Nov 2019, 8:00 PM
Abdul Wahab
Abdul Wahab - avatar
0
I want to enter random string and then enter word to search in tht string then pass it to Method and if found in string then it should print the index and the word
21st Nov 2019, 8:06 PM
Abdul Wahab
Abdul Wahab - avatar
0
Sami Khan not working
21st Nov 2019, 8:18 PM
Abdul Wahab
Abdul Wahab - avatar
0
Example: "Welcome to sololearn" Word: sololearn Output : at 11 sololearn Is this you want to acheive??
21st Nov 2019, 8:21 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
0
Yeahhhh
21st Nov 2019, 8:21 PM
Abdul Wahab
Abdul Wahab - avatar