Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Spliting strings

Hey,

I have a richtextbox with the following content:

Code
abcd*efgh*ijkl*mnop
1234*5678*9101*1121

I have the following code to extract each line from the richtextbox:
Code
For Each file In b.Text
        Dim item As String = file.ToString
        Dim first As String() = item.split("*")(0)
        Msgbox(first)
Next

But that code, for some reason, returns only the first letter, so or a, or 1.

Why?

How else could I do this?

SIGNATURE FOR SALE, PM ME!
Code
For Each file In b.Text
      Dim item As String = file.ToString
      Dim first As String() = item.split("*")
      Dim fValue as String =  first(0)
      Dim sValue as String =  first(1)
      Msgbox(fValue)
Next

This will work and may be more useful in the future.
Your problem is on this line:
PHP Code

<?php 
Dim first 
As String() = item.split("*")(0) 
Remove the () in the Dim first as string()
[Image: WMwSRhx.gif]
I could fix the code for you, but it's better to learn for yourself.
http://howtostartprogramming.com/vb-net/...g-strings/
Code
For each Item as string in textbox.lines
Dim Value as string = split(item,"*")(0)
Next

Should work fine
Got it sorted and is now working, thanks for your help.

SIGNATURE FOR SALE, PM ME!


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by pro_fesnoobSep 24, 2022 04:24 PM 14 797 Sep 24, 2022 04:24 PM
Last Post: BinaryFox
[.NET] by SIM-574702Mar 31, 2015 03:05 PM 5 136 Mar 31, 2015 03:05 PM
Last Post: Ninja
[.NET] by CatSoupNov 17, 2014 06:20 PM 9 641 Nov 17, 2014 06:20 PM
Last Post: NETExplorer