Passing fixed length string array to function
#5
I'm guessing that what you're trying to do with STRING * 8 is just make certain to properly align the data?

If so, try something like this:

Code: (Select All)
Dim ss(8) As String
ss(1) = "One"
ss(2) = "Two"
ss(3) = "Three"

Color 4, 1 'so we can see our spaces

For i = 1 To 8 'to right align the data
    temp$ = "        "
    Mid$(temp$, 9 - Len(ss(i))) = ss(i)
    ss(i) = temp$
Next


For i = 1 To 8
    Print ss(i)
Next

'reset the data
ss(1) = "One"
ss(2) = "Two"
ss(3) = "Three"


For i = 1 To 8 'to left align the data
    ss(i) = ss(i) + Space$(8 - Len(ss(i)))
Next


For i = 1 To 8
    Print ss(i)
Next
Reply


Messages In This Thread
RE: Passing fixed length string array to function - by SMcNeill - 08-25-2022, 04:16 AM



Users browsing this thread: 1 Guest(s)