I have a string, lets call it "S" and it can be up to 8 digits log, and I want to align it in a string, and later in a text file to the right in 8 blanks (chr(32))
Ex. ( I put underscores in the example to mark the blanks.
S="1234" should result in "____1234"
S="444444" should result in "__444444"
S="abc" should result in "_____abc"
For this I would write the following code
Public Function feld(ByVal S As String, Optional I As Integer = 8) As String
Dim lenS As Integer = Strings.Len(S)
Dim vorS As Integer = I - lenS
Dim rez As String = ""
For x = 1 To vorS
rez += Strings.Chr(32)
Next
rez += S
Return rez
End Function
Is there a more elegant way to do this?