The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

Add leading Zeros

xDStickerxDSticker Member Posts: 16 Contributor II
edited November 2018 in Help
Dear Dataminers,

I try to add leading zeros to the numbers within an attribut. Is there any way to do so?

I tried to find a regualr expression but couldn't find a solution :(

Thank you for your time
Sticker

Answers

  • MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    It's not thaaat easy, but it is possible. First of all, you have to convert the numerical attribute into a nominal attribute with Numerical to Polynominal. Then you have to create several regular expressions. For 3-digit values in the form:

    ^(\d)$ -> 00$1
    ^(\d\d)$ -> 0$1

    The caret specifies that the expression must be matched at the beginning of the string, the dollar stands for the end of the string. Both together require an exact match.

    Best regards,
    Marius
Sign In or Register to comment.