I'm trying to format Strings as they arrive and meet certain criteria. However if the tokens below are of different length things don't match up, How do I do this? I want all the "IP address"s to match up. I assume I use something like %20s?
if (tokens.length == 4 && (tokens[3].equals("up") || tokens[3].equals("down"))){
String result = String.format("%s is %s. IP address: %s \n", tokens[0], tokens[2], tokens[1]);
final String ReceivedText = mReceiveBox.getText().toString() + result;
if(tokens[2].equals("up")){
runOnUiThread(new Runnable() {
public void run() {
mReceiveBox.setText(ReceivedText);
mReceiveBox.setSelection(ReceivedText.length());
}
});
}
}