Mac _CLIPBOARD$ Bug??
#3
Here's how it works for Windows, I don't have Mac to test it on but you aren't depending on Mac's Clipboard.
Code: (Select All)
f$ = _OpenFileDialog$("Get File to process", _CWD$, "*.bas", "any bas file", -1)
ReDim fArr$(1 To 1)
Split f$, "|", fArr$()
For i = LBound(fArr$) To UBound(fArr$)
    Print fArr$(i)
Next

' note: I buggered this twice now, FOR base 1 array REDIM MyArray (1 to 1) AS ... the (1 to 1) is not same as (1) which was the Blunder!!!
'notes: REDIM the array(0) to be loaded before calling Split '<<<< IMPORTANT dynamic array and empty, can use any lbound though
'This SUB will take a given N delimited string, and delimiter$ and create an array of N+1 strings using the LBOUND of the given dynamic array to load.
'notes: the loadMeArray() needs to be dynamic string array and will not change the LBOUND of the array it is given.  rev 2019-08-27
Sub Split (SplitMeString As String, delim As String, loadMeArray() As String)
    Dim curpos As Long, arrpos As Long, LD As Long, dpos As Long 'fix use the Lbound the array already has
    curpos = 1: arrpos = LBound(loadMeArray): LD = Len(delim)
    dpos = InStr(curpos, SplitMeString, delim)
    Do Until dpos = 0
        loadMeArray(arrpos) = Mid$(SplitMeString, curpos, dpos - curpos)
        arrpos = arrpos + 1
        If arrpos > UBound(loadMeArray) Then ReDim _Preserve loadMeArray(LBound(loadMeArray) To UBound(loadMeArray) + 1000) As String
        curpos = dpos + LD
        dpos = InStr(curpos, SplitMeString, delim)
    Loop
    loadMeArray(arrpos) = Mid$(SplitMeString, curpos)
    ReDim _Preserve loadMeArray(LBound(loadMeArray) To arrpos) As String 'get the ubound correct
End Sub

   
As you can see multiple Pathed Filenames.
b = b + ...
Reply


Messages In This Thread
Mac _CLIPBOARD$ Bug?? - by tothebin - 01-23-2023, 09:57 PM
RE: Mac _CLIPBOARD$ Bug?? - by bplus - 01-23-2023, 10:07 PM
RE: Mac _CLIPBOARD$ Bug?? - by bplus - 01-23-2023, 11:06 PM
RE: Mac _CLIPBOARD$ Bug?? - by mnrvovrfc - 01-24-2023, 02:55 AM
RE: Mac _CLIPBOARD$ Bug?? - by bplus - 01-24-2023, 07:30 PM
RE: Mac _CLIPBOARD$ Bug?? - by tothebin - 01-24-2023, 09:18 PM
RE: Mac _CLIPBOARD$ Bug?? - by tothebin - 01-31-2023, 11:03 PM
RE: Mac _CLIPBOARD$ Bug?? - by bplus - 01-31-2023, 11:26 PM
RE: Mac _CLIPBOARD$ Bug?? - by tothebin - 01-31-2023, 11:31 PM
RE: Mac _CLIPBOARD$ Bug?? - by mnrvovrfc - 01-31-2023, 11:37 PM
RE: Mac _CLIPBOARD$ Bug?? - by tothebin - 02-01-2023, 12:50 AM



Users browsing this thread: 4 Guest(s)