Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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

Possibly Related Threads…
Thread Author Replies Views Last Post
Star Suggestion for new REPLACE$() function zaadstra 3 264 01-26-2026, 05:11 PM
Last Post: grymmjack
Question Experimenting with a "StringList" type for simpler handling of string arrays/lists Heimdall 18 1,261 12-19-2025, 12:51 PM
Last Post: Heimdall
  Is there a menu function? Mad Axeman 17 1,125 12-17-2025, 04:43 AM
Last Post: SMcNeill
  Sub not Reconizing Dim as String pmackay 18 1,477 10-16-2025, 03:32 PM
Last Post: pmackay
  getting the number of dimensions in an array on the fly? madscijr 7 752 09-16-2025, 12:34 AM
Last Post: madscijr

Forum Jump:


Users browsing this thread: 1 Guest(s)