Open HIMESH1018 opened 1 year ago
")
@mazenrashed
You have to format your string. I format my Strings in a method like this (32 Characters in Line for my Printer)
private String formatForColum (String item, String price) {
float f1 = Float.parseFloat(price);
String formattedPrice = String.format("%.02f", f1); //2 Decimals
String column1Format = "%-24.24s"; // fixed size 24 characters, left aligned
String column2Format = "%7.7s"; // fixed size 7 characters, right aligned
String formatInfo = column1Format + " " + column2Format;
return String.format(formatInfo, item, formattedPrice);
}