.Split on 64-bit

Good point… they SHOULD be UTF-8 but probably better to be safe…

current app has 57 Split operations sprinkled thru it… and I want to compile it for 64bit without having to upgrade Xojo from 2016r4.1 (since I am broke)

For what it’s worth I use Split a lot and I only compile for 64 bit now. I haven’t had a problem but I like the idea of your function.

There are two new Targets defined, Target32Bit and Target64Bit. Using these you can change the compile options to cope with both. I would also use the extends keyword.

[code]Public Function Split64(extends source as string,delimiter as string) as string()
Dim lst() As String
source = DefineEncoding(source, Encodings.UTF8)

#if Target64Bit then
lst = Split(source.ToText,delimiter)
#else
lst = source.Split(delimiter)
#endif

return lst
End Function[/code]
Now you can change all instances of Split to Split64.

Split64 function should work with both 32 and 64 bit without the need for “target” I would think

And I HOPE would work that same way for macOS vs Windows

Since ultimately I want to have a 64bit version that works for both OS

I’m waiting to have this fixed because I can’t do much testing of 64bit without split.

Changing from string to text is super-high risk IMO.

[quote=335033:@Beatrix Willius]I’m waiting to have this fixed because I can’t do much testing of 64bit without split.

Changing from string to text is super-high risk IMO.[/quote]
Why? (asking to be educated, not to argue)

My financial situation does not allow me to wait

My data is highly encoding-sensitive. Having incorrect encodings is normal for my data.

I played around with the new text type a while ago and it took me only a couple of minutes to run into the BadDataException (something like that). And when having little surprises like this one here <https://xojo.com/issue/48050> I think we will have lots of fun with both 64bit and the text type. This changes fundamental behavior which we have relied on for a long time. It doesn’t matter what is correct or what is better.

Public Function Split64(source as string,delimiter as string) as string() Return Split(source.ToText,delimiter) End Function
doesn’t work for me.
It’s longer, but I do :

[code]Dim CeTabTxt(-1) as Text ’ Les fonctions Split et Join ne fonctionnent pas (ou mal) en Build 64-bit
Dim iNbre, Fin_iNbre as Int16 ’ Ces mthodes fonctionnent mais sont plus lentes
Dim CeTabStr(-1) as String

CeTabTxt = CeText.ToText.Split(CeSep.ToText)
Fin_iNbre = CeTabTxt.Ubound
’ MsgBox “NbElts de MySplit(” + CeText + ", " + CeSep + ") = " + str(Fin_iNbre)
For iNbre = 0 to Fin_iNbre
CeTabStr.Append CeTabTxt(iNbre) ’ .ToString
Next iNbre

Return CeTabStr ’ On retourne un Tableau de String, Return Type : String()
[/code]

In one of my program I use characters like :
WinMain.TabSymb = Array("?", “”, “#”, “?”, “”, “?”, “+”, “-”, “?”, “<>”, “>”, “<”, “X”, “X”, “”, “”)
which works with my Method but not with yours.

Then it seems Split (on string) works in 64-bit with ASCII characters only, your method works with “standard” other characters, but if we use “strange” characters ("?", “”, “?”,) it doesn’t work.