UnZeroFill

An utility to remove leading zeros from a string 

A procedure to use in Seeburger BIC Mapping Designer
It will extend your library for string handling

//    
//    Peter Lykkegaard, 18 april 2020
//    -----------------------------
//    Remove leading zeros
 
//    TODO! Check parameters if they are of valid type/content
//
//    Name: unZeroFill
//    Description:
//    Parameters
//        input$, alphanumerical / String which have leading zeros removed
//        Output, alphanumeric / String without leading zeros

#javaStart
    String output = _StrVar_INPUT.getString();
    // Only if numeric remove leading zeros
    if (output.matches("\\d+"))
    {
        output = output.replaceFirst("^0+(?!$)", "");
    }
    _StrVar_OUTPUT.setString(output);
#javaEnd

exitProc(output$);

 

Comments are closed