Class StringBuilderUtil

java.lang.Object
com.reve.utils.string.StringBuilderUtil

public class StringBuilderUtil extends Object
  • Constructor Details

    • StringBuilderUtil

      public StringBuilderUtil()
  • Method Details

    • appendNumber

      public static StringBuilder appendNumber(StringBuilder stringBuilder, long value, int digitCounts)
      Append the given number into the StringBuilder. It will be made sure that the number takes exactly the given number of digit count. If the value exceeds the number of digits than the given number of digitCounts, it will discard the most significant numbers. And if the value have less digits than given digitCounts, it will add extra 0 as prefix to the number. for example value = 10, digitCounts = 3 will append 010 value = 1234, digitCounts = 3 will append 234
      Parameters:
      stringBuilder - given number will be appended into this instance.
      value - this value will be appended.
      digitCounts - number of digits to be appended.
      Returns:
      the same instance of StringBuilder