package de.ivu.elect.util;

import java.util.regex.Pattern;

public class TrimUtil {

  private static final Pattern LEADING_ZEROS = Pattern.compile("^0+(?!$)");

  /**
   * https://stackoverflow.com/a/2800839
   */
  public static String removeLeadingZeros(String s) {
    if (s == null) {
      return s;
    }
    return LEADING_ZEROS.matcher(s.trim()).replaceFirst("");
  }

}
