Bluepoint Design

Practical cost effective solutions   
Macro Express Sample Macro: Text Padding

Home
Up
Multiple Choice Trick
Multiple Multiple Choice
Occurrences
Repeat Validation
GoTo
First file
Fax PDF Breakup
Day of Year
Multiple Attachments
Multiple eMail Addresses
Text Padding
Building TSV Files
How to pad text easily.

The usual application of this is for file names where one need numerically named files to appear sequentially instead of 1, 10, 2 but there are other applications as well. A long tie ago I came up with mildly complex algorithms to accomplish this but I found a quick and dirty way using the Pad Text capability with a twist. This also comes in handy when using an integer repeat counter to create sequential file names.

The trick is to replace all occurrences of the space with a zero!

Remove padding: In order to convert a padded number back simply convert to an integer and, if needed, convert back to a text string.

Pad.mex

Page last updated: 02/05/2008

 
Practical cost effective solutions