3 列目と 4 列目に表示されているオブジェクトの最後の 4 文字をトリミングしたい(Room Type)
(Meal type)
列の下にあるように、出力のサンプルを提供しました。トリップする。
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
Room Type
との最後の 4 文字を削除するにはどうすればよいMeal Type
ですか?