HeadingZeros Remove and Add

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


Public

Tested

My Own Work
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

FromString
or
ToString, TotalLeng

Views 1023 Downloads 411

Classic ASP Texts + Strings
ANmarAmdeen
658
Attachments
Revisions

v1.0