MCPcopy Create free account
hub / github.com/apache/tomcat / padLeft

Method padLeft

java/org/apache/catalina/ssi/SSIFsize.java:87–94  ·  view source on GitHub ↗

Pads the given string with leading spaces to reach the specified maximum length. @param str the string to pad @param maxChars the target length @return the padded string

(String str, int maxChars)

Source from the content-addressed store, hash-verified

85 * @return the padded string
86 */
87 public String padLeft(String str, int maxChars) {
88 String result = str;
89 int charsToAdd = maxChars - str.length();
90 if (charsToAdd > 0) {
91 result = " ".repeat(charsToAdd) + str;
92 }
93 return result;
94 }
95
96
97 // We try to mimic httpd here, as we do everywhere.

Callers 1

formatSizeMethod · 0.95

Calls 1

lengthMethod · 0.80

Tested by

no test coverage detected