Define Stringformat for tabs?

て烟熏妆下的殇ゞ 提交于 2020-01-06 19:44:13

问题


I have a little bug to fix. You can see in the Picture 3 Months outputed.

So that is my code how I displat this result. I try String.format but I dont know how to use it at this tabs. I try it with this tabs but unfortunally I find out that the format for the first Month (January) is short then the other month. All months use 3 tabs but not the first one.

public LinkedList<String> buildMonth(int month) {
    int lengthOfMonth = calender.getLengthOfMonth(this.year, month);
    LinkedList<String> monthList = new LinkedList<>();
    monthList.add(String.format("%-10s",monthname[month]) + String.format("%-17s", this.year));

    for (int day = 1; day <= lengthOfMonth; day++) {
        int daynumber = kf.daynumber(day, month, this.year);
        int weekday = kf.weekday_in_year(this.year, daynumber);
    //weekday give me a number where I can find out wich weekname

            String monthPlan = weekdayShort[weekday] + "|" + String.format("%02d",day) +"|\t\t\t|" +String.format("%-10s",calender.getTwoDigit(daynumber));
            monthList.add(monthPlan);


    }
    return monthList;
}

I hope anyone can help and sorry for my bad english.

Best Regard Maskulin

来源:https://stackoverflow.com/questions/44476433/define-stringformat-for-tabs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!