im doing on my translation app, i have some problem in my main translator. for example like my code below, i want to tranform "bed"into "bad" and if last char is "m" it will transform to "t". when my input was "BEDROOM" i want to transform it into "BADROOT" that code below just read my first statement, and the other became false.
private void MachinetranslatorO(){
String change= input.getText().toString();
if (change.substring(0,3).equals("bed")){
String change1 = change.replaceFirst("bed", "bad");
result.setText(change1);
if (change.substring(change.length()-1).equals("m")){
char replaceWith='t';
StringBuffer aBuffer = new StringBuffer(change);
aBuffer.setCharAt(change.length()-1, replaceWith);
result.setText(aBuffer)
PLEASE HELP ME
Aucun commentaire:
Enregistrer un commentaire