Class StringUtils

java.lang.Object
growthbook.sdk.java.util.StringUtils

public final class StringUtils extends Object
  • Method Details

    • normalize

      public static String normalize(@Nullable String value)
    • isBlank

      public static boolean isBlank(@Nullable String value)
    • padLeftZeros

      public static String padLeftZeros(String inputString, Integer length)
    • paddedVersionString

      public static String paddedVersionString(String input)
    • jsNumberToString

      public static String jsNumberToString(double value)
      Formats a number like JavaScript's String(number) (ECMAScript Number::toString), so numeric operands compare like they do in the JS SDK. Double.toString(double) can't be used: before JDK 19 it doesn't always give the shortest digits, and it uses a different notation.
      Parameters:
      value - the number to format
      Returns:
      the shortest decimal digits that round-trip to value, in plain notation unless the decimal exponent is 21 or more, or -7 or less (for example "1000", "1.5", "0.000002", "1e+21", "1e-7")