Class StringUtils

java.lang.Object
io.opentelemetry.api.internal.StringUtils

@Immutable public final class StringUtils extends Object
Utilities for working with strings.

This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.

  • Method Details

    • isNullOrEmpty

      @Contract("null -> true") public static boolean isNullOrEmpty(@Nullable String string)
      Returns true if the given string is null or is the empty string.

      This method was copied verbatim from Guava library method com.google.common.base.Strings#isNullOrEmpty(java.lang.String).

      Parameters:
      string - a string reference to check
      Returns:
      true if the string is null or is the empty string
    • padLeft

      public static String padLeft(String value, int minLength)
      Pads a given string on the left with leading 0's up the length.
      Parameters:
      value - the string to pad
      minLength - the minimum length the resulting padded string must have. Can be zero or negative, in which case the input string is always returned.
      Returns:
      the padded string
    • isPrintableString

      public static boolean isPrintableString(String str)
      Determines whether the String contains only printable characters.
      Parameters:
      str - the String to be validated.
      Returns:
      whether the String contains only printable characters.