LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Remove Leading Zeros

    Employee
    Posted 10-02-2011 21:21

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Rapkat

    I have a set of data, the data type is a string.

    Some of my data has leading zeros from 1-5, there are alpha characters also. Basically there is no standard format.

    Examples:

    000010705
    0010709
    001530S
    010155
    021188S
    021243S
    02CE8964810

    How can I remove any number of leading zeros?


  • 2.  RE: Remove Leading Zeros

    Employee
    Posted 10-02-2011 22:21

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: mermacora

    I�d use the regexSubstitute() BRAINScript function to achieve this. For example, if your input string field is named MyString you would use this script in a Filter node:

    emit *
    # Remove leading 0's from input field MyString
    emit MyString.regexSubstitute("^0+","") as MyString2


    Hope this helps,
    Mario


  • 3.  RE: Remove Leading Zeros

    Employee
    Posted 10-03-2011 14:33

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Rapkat

    Thanks Mario works like a dream.