public static String leftPad ( String value , int length ) { value = StringUtil . trimToEmpty ( value ) ; if ( value . length ( ) >= length ) { return value ; } return StringUtil . repeat ( " " , length - value . length ( ) ) + value ; }
Adds spaces to the left of the input value until the string has reached the given length . Nothing is done if the string already has the given length or if the string is even longer .