• Welcome to Valhalla Legends Archive.
 

Split help.

Started by GoSu_KaOs, December 03, 2004, 07:59 PM

Previous topic - Next topic

GoSu_KaOs

How can I make this. I got Text1.text and Listview1. I want to make it so if  you type " Item1:Item2" in the textbot, then save it. After it loads everything in to listview1, I want "Item1" to go to 1 column and "Item2" to go into another column.

Networks


Item1 = Split(Usertexthere, ":")(0)
Item2 = Split(Usertexthere, ":")(1)


Another way:


Dim Splt() as string
Splt() = Split(Usertexthere, ":")

Item1 = Splt(0)
Item2 = Splt(1)


(Which ever is more convient for you.)

R.a.B.B.i.T

Just a forenot: the first method will be slower if you have more than a few splits, however.

Networks

Split would be more cool if you could place an 'or' in it like:
split(string, "+" or "-")

GoSu_KaOs

The second meathod worked for me. Thx

Hdx

Quote from: Networks on December 03, 2004, 11:28 PM
Split would be more cool if you could place an 'or' in it like:
split(string, "+" or "-")

replace(string, "-", "")
Bla = split(string, "+")

??
~-~(HDX)~-~

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

LivedKrad

Quote from: HdxBmx27 on December 03, 2004, 11:40 PM
Quote from: Networks on December 03, 2004, 11:28 PM
Split would be more cool if you could place an 'or' in it like:
split(string, "+" or "-")

replace(string, "-", "")
Bla = split(string, "+")

??
~-~(HDX)~-~
Although that works, it poses two problems. One being that it is slower to do two operations that would otherwise be in one intrinsic function already. The second is that it could replace an instance of "-" that you *may have* wanted to keep a "+". I would assume this because - and + are probably denoting the adding/subtracting of access flags from a user. Now, the way you *could* use that would be to fire a Boolean if "-" is found in the command. That way, you can adjust control flow to use the proper procedures accordingly.

Edit: BTW, that's also slow too. :P

Hdx

Ah ok, if you wanted to do it that way you could just do a loop and then split each part by "-", but this is extreemly slow, so Ya i get what your saying. O an crap I jsut noticed i did it worng in my post it was suposto be String = eplace(string, "-", "+") but meh.
~-~(HDX)~-~

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

Networks

Quote from: LivedKrad on December 04, 2004, 09:05 AM
Quote from: HdxBmx27 on December 03, 2004, 11:40 PM
Quote from: Networks on December 03, 2004, 11:28 PM
Split would be more cool if you could place an 'or' in it like:
split(string, "+" or "-")

replace(string, "-", "")
Bla = split(string, "+")

??
~-~(HDX)~-~
Although that works, it poses two problems. One being that it is slower to do two operations that would otherwise be in one intrinsic function already. The second is that it could replace an instance of "-" that you *may have* wanted to keep a "+". I would assume this because - and + are probably denoting the adding/subtracting of access flags from a user. Now, the way you *could* use that would be to fire a Boolean if "-" is found in the command. That way, you can adjust control flow to use the proper procedures accordingly.

Edit: BTW, that's also slow too. :P

haha Krad knew exactly what I was referring to :). I had to use a loop.