So I have two Strings, one named WORD and other LINES. WORD is a string which user enters in an edit text. LINES the same length of WORD but it is only consisted of '-' characters; for example if a WORD is "python" it would be "------" and so on. I also have another editText in witch user enters a character. If user enters a character which is contained in WORD, I want to replace all '-' in LINES where that character appears in WORD; For example, if a WORD is "overflow" and user enters a 'o' I want LINES to be "o-----o-".
Asked
Active
Viewed 17 times
0
-
And what have you done so far? What is your approach? – LuCio Jul 19 '18 at 10:03
-
for (char c : word.toCharArray()) { if (c+"" == letter) { lines.replace("-", c + ""); } } – Damjan Vlaic Jul 19 '18 at 10:06
-
it is complicated a little just know that i used c+"" to make it string so that i can compare it to letter which is already a string in my code – Damjan Vlaic Jul 19 '18 at 10:07