55
66package io .opentelemetry .api .internal ;
77
8- import java .util .Objects ;
98import javax .annotation .Nullable ;
109import javax .annotation .concurrent .Immutable ;
1110
@@ -32,52 +31,6 @@ public static boolean isNullOrEmpty(@Nullable String string) {
3231 return string == null || string .isEmpty ();
3332 }
3433
35- /**
36- * Pads a given string on the left with leading 0's up the length.
37- *
38- * @param value the string to pad
39- * @param minLength the minimum length the resulting padded string must have. Can be zero or
40- * negative, in which case the input string is always returned.
41- * @return the padded string
42- */
43- public static String padLeft (String value , int minLength ) {
44- return padStart (value , minLength , '0' );
45- }
46-
47- /**
48- * Returns a string, of length at least {@code minLength}, consisting of {@code string} prepended
49- * with as many copies of {@code padChar} as are necessary to reach that length. For example,
50- *
51- * <ul>
52- * <li>{@code padStart("7", 3, '0')} returns {@code "007"}
53- * <li>{@code padStart("2010", 3, '0')} returns {@code "2010"}
54- * </ul>
55- *
56- * <p>See {@link java.util.Formatter} for a richer set of formatting capabilities.
57- *
58- * <p>This method was copied almost verbatim from Guava library method
59- * com.google.common.base.Strings#padStart(java.lang.String, int, char).
60- *
61- * @param string the string which should appear at the end of the result
62- * @param minLength the minimum length the resulting string must have. Can be zero or negative, in
63- * which case the input string is always returned.
64- * @param padChar the character to insert at the beginning of the result until the minimum length
65- * is reached
66- * @return the padded string
67- */
68- private static String padStart (String string , int minLength , char padChar ) {
69- Objects .requireNonNull (string );
70- if (string .length () >= minLength ) {
71- return string ;
72- }
73- StringBuilder sb = new StringBuilder (minLength );
74- for (int i = string .length (); i < minLength ; i ++) {
75- sb .append (padChar );
76- }
77- sb .append (string );
78- return sb .toString ();
79- }
80-
8134 /**
8235 * Determines whether the {@code String} contains only printable characters.
8336 *
0 commit comments