+ 1

Anyone can make a program in java with below description ??

Write a java program which takes a character and a sentence as input. Print the position numbers where the character appears in that line. If the character does not appears in the sentence at all, print -1. Input Specification : First input is a single character. Second input is a sentence. Output Specification: Print the position numbers at where that character appears in the sentence. If the character does not appears in the sentence at all, print -1.

27th Jun 2017, 5:29 AM
Amandeep
Amandeep - avatar
15 ответов
+ 4
ooooo
27th Jun 2017, 11:08 AM
Limitless
Limitless - avatar
27th Jun 2017, 11:19 AM
Limitless
Limitless - avatar
+ 4
limitless_za for Instagram
27th Jun 2017, 11:47 AM
Limitless
Limitless - avatar
+ 3
Can you give an example?
27th Jun 2017, 11:04 AM
Limitless
Limitless - avatar
+ 3
Like input - output example
27th Jun 2017, 11:05 AM
Limitless
Limitless - avatar
+ 3
Do you have Discord?
27th Jun 2017, 11:34 AM
Limitless
Limitless - avatar
+ 2
There's already a function that does for you. String.indexOf(char); https://code.sololearn.com/c3KZFf8weUUH/?ref=app
27th Jun 2017, 7:16 AM
Limitless
Limitless - avatar
+ 1
if you are on whatsapp or facebook tell me.. its hard to write code again and again. I will send u picture of my code.It works well. However it didnt passes the test cases
27th Jun 2017, 11:10 AM
Amandeep
Amandeep - avatar
27th Jun 2017, 7:06 AM
Vaibhav Tandon
Vaibhav Tandon - avatar
0
i want all occurance of a char in a string
27th Jun 2017, 8:39 AM
Amandeep
Amandeep - avatar
0
Yes, input : i i love java output : 1 input: i this is Ignite output : 3 6 9 12
27th Jun 2017, 11:06 AM
Amandeep
Amandeep - avatar
0
Thanks i knw it works. Still it didnt passes the test cases
27th Jun 2017, 11:28 AM
Amandeep
Amandeep - avatar
0
i cant send u screenshot here, can u give ur fb id?
27th Jun 2017, 11:33 AM
Amandeep
Amandeep - avatar
0
what is discord?
27th Jun 2017, 11:36 AM
Amandeep
Amandeep - avatar
0
i have fb, instagram, whatsapp.. i can send u screenshot there
27th Jun 2017, 11:37 AM
Amandeep
Amandeep - avatar