Very fast split string to array function

Windows specific forum
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Post by J. Baker »

Nice work Wilbert! On your speed test I got 0ms and 10ms, very fast indeed. :D

KoolMoves Rocks! :D
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

hey nog een nederlander...

although i'm not much into using libs, this one may come in handy :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3942
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Post by wilbert »

Hi Joe, You are right...
KoolMoves / EazyFlash (japanese version) / Freestyle Flash (dutch version)
Rocks :D

En inderdaad blueznl... nog een nederlander. Je komt ze ook overal tegen he :wink:

About arrays...
I also want to do some array push / pop functions if they won't appear in PB 4.0. I think it would be great if you could split a string into an array and pop off items until the array is empty.
eriansa
Enthusiast
Enthusiast
Posts: 277
Joined: Wed Mar 17, 2004 12:31 am
Contact:

Post by eriansa »

very handy - zeer handig
thanks a lot - hartelijk dank

...en dat voor een hollander :wink:
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3942
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Post by wilbert »

eriansa wrote:...en dat voor een hollander :wink:
Brabant grenst aan Vlaanderen hè. :idea:
Misschien dat dat een hoop verklaart :wink:
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

intelligence knows no borders :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
eriansa
Enthusiast
Enthusiast
Posts: 277
Joined: Wed Mar 17, 2004 12:31 am
Contact:

Post by eriansa »

There is an error in your routine : see ->

Code: Select all

Dim arrValuelist.s(0)
sz.s="10:20,10,50,10,90"
For i = 0 To 9
Select i
Case 0
  sz.s="11111111111111111111111111111"
Case 1
  sz.s="10,111"
Case 2
  sz.s="101,111"
Case 3
  sz.s="1010,111"
Case 4
  sz.s="10101"
Case 5
  sz.s="1010"
Case 6
  sz.s="101"
Case 7
  sz.s="10"
Case 8
  sz.s="1"
Case 9
  sz.s="11111111"
EndSelect
arrValuelist() = wb_SplitStringByChar(sz, ",", #True, arrValuelist())
NrOfValues = wb_ArrayCount(arrValuelist())
Debug arrValuelist(0)
Next
eriansa
Enthusiast
Enthusiast
Posts: 277
Joined: Wed Mar 17, 2004 12:31 am
Contact:

Post by eriansa »

Het werkt wel als je steeds een seperator vermeldt (in dit geval een comma)

Code: Select all

Dim arrValuelist.s(0)
sz.s="10:20,10,50,10,90"
For i = 0 To 9
Select i
Case 0
  sz.s="11111111111111111111111111111"
Case 1
  sz.s="10,111" + ","
Case 2
  sz.s="101,111" + ","
Case 3
  sz.s="1010,111" + ","
Case 4
  sz.s="10101" + ","
Case 5
  sz.s="1010" + ","
Case 6
  sz.s="101" + ","
Case 7
  sz.s="10" + ","
Case 8
  sz.s="1" + ","
Case 9
  sz.s="11111111"
EndSelect
arrValuelist() = wb_SplitStringByChar(sz, ",", #False, arrValuelist())
NrOfValues = wb_ArrayCount(arrValuelist())
Debug arrValuelist(0)
Next
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3942
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Post by wilbert »

Would you please try if this version works fine ?
www.geboortegrond.nl/pb/wb_Lib.zip

Wilbert
eriansa
Enthusiast
Enthusiast
Posts: 277
Joined: Wed Mar 17, 2004 12:31 am
Contact:

Post by eriansa »

Looks OK!
Thanks a lot.
tatanas
Enthusiast
Enthusiast
Posts: 260
Joined: Wed Nov 06, 2019 10:28 am
Location: France

Re: Very fast split string to array function

Post by tatanas »

Hi Wilbert,

I was looking for a fast split string to array function and found this topic.
I know it's a pretty old one :? but I can't get your zip. I guess there should be some code updates since 2004...

Do you have a Purebasic 6 compatible version of this code ?

Thanks for your time.
Windows 10 Pro x64
PureBasic 6.20 x64
User avatar
mk-soft
Always Here
Always Here
Posts: 6242
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Very fast split string to array function

Post by mk-soft »

My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3942
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Very fast split string to array function

Post by wilbert »

tatanas wrote: Fri Dec 15, 2023 11:22 am I know it's a pretty old one :? but I can't get your zip. I guess there should be some code updates since 2004...
You can still down;oad it
https://w73.nl/pb/split.zip
but it's not a code source but a user library.
I don't even know if I still have the original source code and if it still works it would be only for the 32 bit x86 version of PB :shock:
So maybe the alternative mk-soft created is a better solution for PB 6.x .
Windows (x64)
Raspberry Pi OS (Arm64)
AZJIO
Addict
Addict
Posts: 2183
Joined: Sun May 14, 2017 1:48 am

Re: Very fast split string to array function

Post by AZJIO »

tatanas wrote: Fri Dec 15, 2023 11:22 am Do you have a Purebasic 6 compatible version of this code ?
https://www.purebasic.fr/english/viewto ... 82#p486382
https://www.purebasic.fr/english/viewtopic.php?t=80656
tatanas
Enthusiast
Enthusiast
Posts: 260
Joined: Wed Nov 06, 2019 10:28 am
Location: France

Re: Very fast split string to array function

Post by tatanas »

Thank you very much. I've got everything I need.
Windows 10 Pro x64
PureBasic 6.20 x64
Post Reply