Notes Tips - Tip #2

Ever had to create a sequential numbering system and the requirements defined a prefix of 0’s? (00003433).
Below is a function I wrote to automate the number generation:
Function AddLeadingZeros(OriginalNum As String, TotalLength As Integer)
AddLeadingZeros = String(TotalLength - Len(OriginalNum),"0") & OriginalNum
End FunctionThe first parameter is the number you wish to use as the base before the prefix of 0’s. The second parameter is the total length you wish the number structure to be.
Eg.
MyNumber = AddLeadingZeros("55",10)Will return 0000000055
.
What’s wrong with Format( 10, String( 55, “0″) ) ?
No need for function…