assertPositiveInt static method

int? assertPositiveInt(
  1. int? in_num
)

1, +

  • 只允许正整数通过,0、负数返回null

Implementation

static int? assertPositiveInt(int? in_num) {
  if (null != in_num && in_num > 0) {
    return in_num;
  }
  return null;
}