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.  Trim leading zero's

    Employee
    Posted 01-23-2014 07:15

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

    Originally posted by: mw9286

    How do I trim leading zero's from string field?

    Thank you,

    Mike


  • 2.  RE: Trim leading zero's

    Employee
    Posted 01-23-2014 07:25

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

    Originally posted by: pdespot

    Hi, Mike.

    There are probably a couple ways to do it, but the quickest is to use the regexSubstitute function. You can just used the regular expression ^0*. ^ means match at the beginning of the string. 0 is what you want to match and * says match any number of occurrences. Put it together and ^0* means "start at the beginning and look for any occurrences of 0". The second argument of regexSubstitute is just going to be "". Because you want to replace anything you found with nothing.

    Have a look at the attached example.

    -Pavel

    Originally posted by: mw9286
    					

    How do I trim leading zero's from string field?

    Thank you,

    Mike

    Attachments:
    remove_zeros.brg


  • 3.  RE: Trim leading zero's

    Employee
    Posted 01-23-2014 07:57

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

    Originally posted by: ejones

    One way is to use the Trim Fields node.

    Set TrimCharacters to 0
    Set TrimDirection to Left

    To make sure it only operates on that one field you should
    Set IncludeOrExcludeFieldSet to Include
    Put the name of the field getting trimmed in FieldSet

    Hmm... I believe this is a question in one of the exercises in the LAE training class Lavastorm provides. So I hope I'm not making things too easy for one of our trainees