+ 1

How to convert string to char to find what i have assign into that string?

i can ask user to tell thir msg but disable to convert it what it means in my decoding?

31st Oct 2017, 8:02 AM
Maha Fatima Memon
Maha Fatima Memon - avatar
4 odpowiedzi
+ 9
System.out.print("" + 'm' + 'a' + 'h' + 'a');
31st Oct 2017, 8:21 AM
qwerty
qwerty - avatar
+ 5
To extract a particular alphabet to char, use:- char c = stringname.charAt(0); This will extract the character at position 0 in the string. Replace 0 with the index(position) you want. Just remember, it starts from 0, not 1. To make a char Array of a string use :- char[] arr = stringname.toCharArray();
31st Oct 2017, 8:09 AM
Meharban Singh
Meharban Singh - avatar
+ 1
i have to not mention position. i have to tell for e.g my name is maha so tell me what is on m+a+h+a
31st Oct 2017, 8:14 AM
Maha Fatima Memon
Maha Fatima Memon - avatar
+ 1
@Maha I didn't get you question. Provide sample input and output.
31st Oct 2017, 9:00 AM
Meharban Singh
Meharban Singh - avatar