- Home
·
- String Manipulation
·
- Ever had a number like this one 205 and wanted to add zeros to the left (000205)? well now you
Ever had a number like this one 205 and wanted to add zeros to the left (000205)? well now you
Ever had a number like this one "205" and wanted to add zeros to the left ("000205")? well now you can.. with this simple function you can
Rate Ever had a number like this one 205 and wanted to add zeros to the left (000205)? well now you
(2(2 Vote))
Dim Factor As Double
Dim AddZero As Integer
Dim Aux As String
Dim I as integer
If Pos > 1 Then
Pos = Pos - 1
Factor = 10 ^ Pos
If N < Factor Then
AddZero = (Pos + 1) - Len(Trim(N))
For I = 1 To AddZero
Aux = Aux & "0"
Next I
Aux = Aux & N
Else
Aux = N
End If
Else
Aux = N
End If
NFormat = Aux
End Function
'You can call the function like this
'Text1 = NFormat(MyNumber, NumberOfPositions)
Ever had a number like this one 205 and wanted to add zeros to the left (000205)? well now you Comments
No comments yet — be the first to post one!
Post a Comment