getValueDigit static method

int getValueDigit(
  1. String value
)

获取目前的小数位数

Implementation

static int getValueDigit(String value) {
  if (value.contains(".")) {
    return value.split(".")[1].length;
  } else {
    return -1;
  }
}