+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 ..

11/21/2019 7:29:38 PM

Abdul Wahab

31 Answers

New Answer

+1

Try to check everything

+5

https://code.sololearn.com/cGj0hCkhj4C2/?ref=app

+4

Use indexOf method to acheive that.. unless you want scratch logic to get it done

+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() ?

+1

Man, Abdul Wahab, you are tired. Change Sent to sent Maybe will work then Is not java case sensitive?

+1

Run this https://code.sololearn.com/cDe9rdB11dha/?ref=app

+1

What are you trying to do? Can't work it out from your code sorry.

+1

if(sent.indexOf(word) != -1){ "do what you like in here" }

+1

https://code.sololearn.com/cAYd9AhzDJTj/?ref=app

+1

Abdul Wahab updated Check out this... Is this what you want? https://code.sololearn.com/cDe9rdB11dha/?ref=app

+1

Abdul Wahab i checked that also and updated also after a few minutes only.. Did you checked that..?

+1

Abdul Wahab wel come

+1

Did you check the code? If you need copy that .. I may be deletes it..

+1

Yeah i copied it thanks

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!!

0

Can u figured it out whts the error plz

0

Jaya krishna s.length- word.length. if i not used this i will get indexoutofbound error

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

0

Sami Khan not working

0

Example: "Welcome to sololearn" Word: sololearn Output : at 11 sololearn Is this you want to acheive??