trimLeadingZeros method

String trimLeadingZeros(
  1. String s
)

Implementation

String trimLeadingZeros(String s) {
  int i = 0;
  while (i < s.length && s[i] == '0') {
    i++;
  }
  if (i == s.length) {
    return '0';
  } else {
    return s.substring(i);
  }
}