Logo Search packages:      
Sourcecode: jlha-utils version File versions  Download package

static String org::jlhafrontend::ListFormatter::_toField ( String  s1,
int  fieldLen,
boolean  leftAlign 
) [inline, static]

padding spaces if a given string is not long enough

Parameters:
s1 the given string
fieldLen minimal length of the return string
leftAlign If true, the space will padding to the end of the string. If false, the space will padding to the head of the string.
Returns:
padded string

Definition at line 81 of file ListFormatter.java.

                                                                            {
        String out1;
        int i;
        if (fieldLen <= s1.length()) {
            out1 = s1;
        } else {
            out1 = s1;
            for (i=0 ; i<fieldLen-s1.length(); i++) {
                if (leftAlign) {
                    out1 = out1 + " ";
                } else {
                    out1 = " " + out1;
                }
            }
        }
        return out1;
    }


Generated by  Doxygen 1.6.0   Back to index