An very easy question about function come in!

Just starting out? Need help? Post your questions and find answers here.
netfriends
User
User
Posts: 36
Joined: Wed Jan 18, 2006 8:25 am
Contact:

An very easy question about function come in!

Post by netfriends »

Is PB has the same function like "split()" in VB ?

vb code

Code: Select all

dim array_1() as string
array_1()=split("qqw|wwq|wqw","|")
debug.print array_1(1)
return "wwq"

how is PB code written?
┏┓ CT+pro Studio - www_ct-pro_com
█┛ From China
┏█ MSN:ct1676@hotmail.com
┗┛ I have felt the pure power already.
|-.-|`o`|`_`|o_o|:_:|'_'|^.^|-_-!|
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Hi netfriends,

PureBasic does not have a split function. But you can do something similar:

Code: Select all

sourceStr.s = "qqw|wwq|wqw"
n = CountString(sourceStr, "|")
Dim Arr.s(n)
For i = 0 To n
  Arr(i) = StringField(sourceStr, i + 1, "|")
Next
For i = 0 To n
  Debug Arr(i)
Next
@}--`--,-- A rose by any other name ..
netfriends
User
User
Posts: 36
Joined: Wed Jan 18, 2006 8:25 am
Contact:

Post by netfriends »

Dare2

Thanks a lot :)
┏┓ CT+pro Studio - www_ct-pro_com
█┛ From China
┏█ MSN:ct1676@hotmail.com
┗┛ I have felt the pure power already.
|-.-|`o`|`_`|o_o|:_:|'_'|^.^|-_-!|
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Post by freedimension »

netfriends signature wrote:If the chinese forum is created...
I hope so
Don't hope, ...
... do it yourself ;)

Someone has to be the first, the rest will follow.

BTW: Where from china are you? I'm just curious :)
<°)))o><²³
netfriends
User
User
Posts: 36
Joined: Wed Jan 18, 2006 8:25 am
Contact:

Post by netfriends »

Hi freedimension
Those just to say ... :D Dn't be cared

Some mouths ago ,I have a website too, Because of $ and school work and so on ~ HEHE It was closed

If more an more chinese want to learn ,PB I will to found the BBS :)
┏┓ CT+pro Studio - www_ct-pro_com
█┛ From China
┏█ MSN:ct1676@hotmail.com
┗┛ I have felt the pure power already.
|-.-|`o`|`_`|o_o|:_:|'_'|^.^|-_-!|
Post Reply