Solved
Add string X times
Posted on 2004-09-09
what im trying to do is have a string added to a string a certian amount of times
this is just an exmple i need to do simlar things, with text strings as well.
for example, The string TestString has to be 5 numbers,
(say the number is 5) add four zeros to the start, (teststring = "00005")
(say the number is 35) add three zeros to the start , (teststring = "00035")
i would like to be able to do somthing like
' StartVars Add string "0", 5 - Len((StartCount + ((i * 30) + x))) times & (StartCount + ((i * 30) + x))
Ref(x) = StartCode & Add0times(5 - Len((StartCount + ((i * 30) + x)))) & (StartCount + ((i * 30) + x))
this is part of my code i already have, but it is really chunky for what it does
For x = 0 To 29
If Len((StartCount + ((i * 30) + x))) = 1 Then
Ref(x) = StartCode & "0000" & (StartCount + ((i * 30) + x))
Num(x) = "0000" & (StartCount + ((i * 30) + x))
ElseIf Len((StartCount + ((i * 30) + x))) = 2 Then
Ref(x) = StartCode & "000" & (StartCount + ((i * 30) + x))
Num(x) = "000" & (StartCount + ((i * 30) + x))
ElseIf Len((StartCount + ((i * 30) + x))) = 3 Then
Ref(x) = StartCode & "00" & (StartCount + ((i * 30) + x))
Num(x) = "00" & (StartCount + ((i * 30) + x))
ElseIf Len((StartCount + ((i * 30) + x))) = 4 Then
Ref(x) = StartCode & "0" & (StartCount + ((i * 30) + x))
Num(x) = "0" & (StartCount + ((i * 30) + x))
ElseIf Len((StartCount + ((i * 30) + x))) = 5 Then
Ref(x) = StartCode & (StartCount + ((i * 30) + x))
Num(x) = (StartCount + ((i * 30) + x))
End If
Next