I have tried to replace a string in an array then conver it to string but it was not like I want. Here is my example:
String data = "ABC 00 0 03 54 BTT";
String[] tokens = data.split("\\s+");
for(int i=0; i<tokens.length; i++){
if(tokens[i] == "BTT"){
tokens[i] = tokens[i].replace("BTT"," ");
}
}
data = Arrays.toString(tokens);
Log.log(Log.VRB, "DEBUG: field =" + data);
OUTPUT: DEBUG: field =[ABC, 00, 0, 03, 54, BTT]
But I had tried to get this output: DEBUG: field = ABC 00 0 03 54
Can anyone give me the idea how can I fix it?
Thanks.