numericalPadLeft method

String numericalPadLeft(
  1. int width
)

Same as padLeft with 0, but respects the numerical signal.

Implementation

String numericalPadLeft(int width) {
  var s = this;
  if (s.startsWith('-')) {
    var n = s.substring(1);
    return '-${n.padLeft(width, '0')}';
  } else {
    return s.padLeft(width, '0');
  }
}