Add undefinite number of characters to strings

Solved!
bored_panda
Level 2
Add undefinite number of characters to strings

I have a string column with a number of chars in it that can be up to 10, I need to fill the beginning of each cell with "0"s so that each cell is 10 chars. So, for instance, transform this




12345
3948
36
1234567890
48975646




Into :




0000012345
0000003948
0000000036
1234567890
0048975646


How can I do that ? (Can't use SQL)
0 Kudos
1 Solution
Clรฉment_Stenac

Hi,



Use a formula. If your column is called stuff and you want 11 chars in the output, use:




format("%011d", stuff)



More info about the format function here: http://answers.dataiku.com/767/how-to-remove-scientific-notation-in-a-column

View solution in original post

3 Replies
Clรฉment_Stenac

Hi,



Use a formula. If your column is called stuff and you want 11 chars in the output, use:




format("%011d", stuff)



More info about the format function here: http://answers.dataiku.com/767/how-to-remove-scientific-notation-in-a-column
bored_panda
Level 2
Author
It almost works, but not quite : format("%011d", stuff) worked. Thanks
0 Kudos
Clรฉment_Stenac
Thanks, edited!
0 Kudos