1

我试图通过为每个列结果设置一个好的选项卡来使我的结果看起来不错。这是我的 toString() 函数。我在stackoverflow中搜索了这个问题,但它没有回答我的问题。我在 Eclipse Java 中找不到 StringUtils.rightPad(String, int) 实用程序。我应该下载任何软件包或任何东西吗?

         public String toString(){
        StringBuffer sb = new StringBuffer(150);
        sb.append(getDept(department));
        sb.append("\t");
        sb.append(getName());
        sb.append("\t");
        sb.append(getAge());
        sb.append("\t");
        sb.append(checks.check());

        return sb.toString();
    }


Here's my result using ("\t") :

Department      Name    Age Prime
__________________________________________________
Information_Systems Hacking Novice  23  true
Accounting  Counting Novice 25  false
Marketing   Sales Savvy 38  false
Information_Systems Hacking Savvy   38  false
Accounting  Counting Savvy  40  false
Accounting  Counting Pro    45  false
Information_Systems Hacking Pro 46  false
Human_Resources Hiring Pro  47  true
Marketing   Sales Pro   48  false
Marketing   Sales Guru  50  false
Information_Systems Hacking Guru    51  false
Accounting  Counting Guru   55  false
Human_Resources Hiring Guru 58  false
4

1 回答 1

1
org.apache.commons.lang.StringUtils.rightPad(String, int)

下载 Commons Lang

于 2013-10-24T08:54:48.367 回答