Adds or remove zeros at start of string
Used to clear heading zeros from string that SQL database adds
HeadingZeros_Remove to remove all heading zeros
HeadingZeros_Add to add zeros until length (TotalLeng) is reached
Function HeadingZeros_Remove(FromString)
Rett = ""
For I = 1 to Len(FromString)
If Not Mid(FromString, I, 1) = "0" Then
' Exit when we find first non-zero
Rett = Mid(FromString, I , 5000)
Exit For
End If
Next
HeadingZeros_Remove = Rett
End Function
Function HeadingZeros_Add(ToString, TotalLeng)
Rett = Right( String(TotalLeng, "0") & ToString, TotalLeng)
HeadingZeros_Add = Rett
End Function
Rett = ""
For I = 1 to Len(FromString)
If Not Mid(FromString, I, 1) = "0" Then
' Exit when we find first non-zero
Rett = Mid(FromString, I , 5000)
Exit For
End If
Next
HeadingZeros_Remove = Rett
End Function
Function HeadingZeros_Add(ToString, TotalLeng)
Rett = Right( String(TotalLeng, "0") & ToString, TotalLeng)
HeadingZeros_Add = Rett
End Function
FromString
or
ToString, TotalLeng
or
ToString, TotalLeng
Views 2,211
Downloads 829
CodeID
DB ID