Is there a way to pad text in order to make it a fixed length? For instance, I have a string of numbers that can be anywhere from one to five characters. If the string only has one character, I would like to add four zeros to the left of the string for a total length of five characters. I'm new to this platform so any assistance is greatly appreciated.
Page 1 / 1
Yes, absolutely. Here are the steps to pad text to make it to a fixed length.
- Get the length of the string using the action: String → Length
- Loop while the length of the string is less than 5.
- Add 0 to your string using the action String → Assign
- Get the length of the string again (within the loop) to check if it has reached 5 in the next iteration.
Attached a sample automation for your reference.
Hope this helps, let me know.
Thank you very much Arjun! I was hoping there might be an action for this. I appreciate your help.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.