Я хочу обрезать последние 4 символа объекта, отображаемого в 3-м (Room Type)
и 4-м(Meal type)
столбцах. как и внизу, я предоставил образец вывода. Вы можете ясно видеть в 3-м и 4-м столбцах, последние 4 символа — это цена в скобках, которую я хочу отключить.
public void showAll()
{
String name ="";
String ID="";
Object roomItem;
Object mealItem;
int roomIn;
int meal;
int days=0;
double tprice=0;
display.setText("");
display.append("ID Customer Name RoomType MealType Days TotalCharge($)");
display.append("\n ---------------------------------");
for (int i = 0; i < myList.size(); i++)
{
Customer c = myList.get(i);
ID = c.getID();
name = c.getName();
roomIn = c.getRoomIndex(); // Get the room index stored in Linked list
roomItem = roomTypeCombo.getItemAt(roomIn); // Get the item stored on that index.
meal = c.getMealIndex(); // Get the Meal index stored in Linked list
mealItem = mealCombo.getItemAt(meal); // Get the item stored on that index.
days = c.getDaysIndex();
tprice = c.getTotalPrice();
display.append("\n"+ID+" "+name+" "+roomItem+" "+mealItem+" "+days+ " "+tprice);
}
display.append("\n \n Total "+myList.size()+" Entrie(s) !");
} // end of function
И вывод моей программы выглядит следующим образом:
ID Customer Name RoomType MealType Days TotalCharge
__________________________________________________________________
234 John Andersen Standard($75) Any Two($30) 4 420.0
как я могу отключить последние 4 символа Room Type
и Meal Type
?