1

I'm trying to make my result looks good by having a good tab for each column result. Here's my toString() function. I searched for this problem in stackoverflow, but it doesn't answer my question. I can't find the StringUtils.rightPad(String, int) utilities in Eclipse Java. Should I download any package or anything?

         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
Ingo
  • 36,037
  • 5
  • 53
  • 100

1 Answers1

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

Download Commons Lang

agad
  • 2,192
  • 1
  • 20
  • 32
  • How can I import to the package into my Eclipse? – Frans Raharja Kurniawan Oct 24 '13 at 09:11
  • You need to add the commons-lang library to your project. The way how to do that, depends on dependency system you use, eg. for maven add ` commons-lang commons-lang 2.6 ` to your pom, for ivy: `` to ivy.xml. And if you don't use any dependency tool, just download the library and add as dependency to your project (Project --> Properties --> Java build Path --> Libraries --> Add JARS.../Add External JARs) – agad Oct 24 '13 at 10:45