J
Jim Pockmire
How can I initialize a string to 200 blank (" ") characters?
David C. Holley said:Function setLength(strString As String, intLength As Integer)
If Len(strString) > intLength Then
setLength = Left(strString, intLength)
Else
setLength = strString & String(intLength - Len(strString), " ")
End If
End Function
Gives the flexibility if needed to establish varying lengths. If the
length of the String is longer than the length to convert to, the original
string will be truncated.
David C. Holley said:But what if the trailing character should be something other than a space?
I did try a variation of the function whereby a third parameter would be
the character to add to the string. However, I realized that there'd have
to be some additional coding to check the length and such.