Function LXFormat(LXString, NumberDigits)
' Format a number found at end of string to have additional leading zeros to match NumberDigits
' LXFormat("E23", 3) > > E023, LXFormat("E5", 3) > > E005
Rett = LXString
For S1 = 1 To Len(LXString)
S2 = Mid(LXString, S1, 1)
If Asc(S2) >= 48 And Asc(S2) <= 57 Then
Rett = Left(LXString, S1 - 1) & Format(Mid(LXString, S1), String(NumberDigits, "0"))
Exit For
End If
Next
LXFormat = Rett
End Function
' Format a number found at end of string to have additional leading zeros to match NumberDigits
' LXFormat("E23", 3) > > E023, LXFormat("E5", 3) > > E005
Rett = LXString
For S1 = 1 To Len(LXString)
S2 = Mid(LXString, S1, 1)
If Asc(S2) >= 48 And Asc(S2) <= 57 Then
Rett = Left(LXString, S1 - 1) & Format(Mid(LXString, S1), String(NumberDigits, "0"))
Exit For
End If
Next
LXFormat = Rett
End Function
LXString, NumberDigits
LXFormat("E23", 3) >> E023, LXFormat("E5", 3) >> E005
Views 81
Downloads 49
CodeID
DB ID