Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
String to Array
#1
A Handy piece of code that will split a string into an array.

Code: (Select All)
Sub StringSplitter (ST As String, AR() As String, DL As String)
    Dim Delim(Len(DL)) As String
    For i = 1 To Len(DL)
        Delim(i) = Mid$(DL, i, 1)
    Next
    c = 1
    Do
        For i = 1 To UBound(Delim)
            If Mid$(ST, c, 1) = Delim(i) Then
                ReDim _Preserve AR(UBound(AR) + 1)
                c = c + 1
                Exit For
            End If
        Next i
        AR(UBound(AR)) = AR(UBound(AR)) + Mid$(ST, c, 1)
        c = c + 1
    Loop Until c > Len(ST)
End Sub
Reply


Messages In This Thread
String to Array - by AtomicSlaughter - 02-13-2023, 10:31 AM
RE: String to Array - by mnrvovrfc - 02-13-2023, 10:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  STRING$ empowered with StringPatternFilling TempodiBasic 6 1,209 05-09-2025, 06:00 PM
Last Post: TempodiBasic
  Split String to Array Using Strtok (Attempt #2) SpriggsySpriggs 0 531 12-17-2024, 06:37 PM
Last Post: SpriggsySpriggs
  PrintW - print a long string, breaking it at the last space or hyphen before col. 79 TDarcos 21 4,017 04-22-2024, 09:52 PM
Last Post: Pete
  Fonts from String Patterns bplus 15 3,676 08-30-2023, 03:01 PM
Last Post: grymmjack
  Remove Spaces (or other characters) from a String George McGinn 10 2,909 12-31-2022, 12:21 PM
Last Post: euklides

Forum Jump:


Users browsing this thread: 1 Guest(s)