I have two Strings.
String a = "Abraham"
String b = "Best Friend"
I want an output similar to this:
Abraham.......OK
Best Friend...OK
I used String.format() to get the following result.
a = String.format("%0$-" + b.lenght() + "s ", a);
b = String.format("%0$-" + b.lenght() + "s ", b);
Abraham OK
Best Friend OK
I can not use String.replace(), because the space between "Best" and "Friend" would be replaced as well.
I found a solution for putting zeroes in front of the beginning of the String. However, i dont understand in which way I should modify this solution to get the desired output.
String sendID = "AABB";
String output = String.format("%0"+(32-sendID.length())+"d%s", 0, sendID);
I found solutions with padded Strings, but i would like to solve this with the String.format()-Method.