Split multiLine Textbox to Strings

Rexy

Member
Joined
Jan 16, 2007
Messages
14
Programming Experience
1-3
I have a clipboard input lokking like this:
Ordre - #3309

Name: Thorkil Anderson
FunStreet 19
4300 BigCity
Denmark

Phone: 59437675
E-Mail adresse: [emaill]thorkil@gmail.com[/email]

And i need to spill it to a number of strings

Eksampel:
OutputString(0)= 3309
OutputString(1)= Thorkil Anderson
OutputString(2)= FunStreet 19
OutputString(3)= 4300
OutputString(4)= 59437675
OutputString(5)= thorkil@gmail.com

I trying to do it like this:
VB.NET:
dim OutputString(5) as string
dim POS as integer = 0

POS = InStr(1, txtIN.text, "#", vbTextCompare)
OutputString(0)= mid(txtIN.text, POS + 1, 5)
But what about the rest..

Please if someone can help
 
Robert_Zenz said:
How about String.Split(vbNewLine) ?
It works somehow, but not how you think, there is no String.Split method (overload) that takes a single string as parameter. You should turn on Option Strict.
 
No, it also has no single Char version, actually it only takes Char array or String array parameters plus some other split options. The version that takes a single Char array as parameter is marked ParamArray which allows multiple single Char to be used, when providing only one Char this method version is used and the Char takes first position of the paramarray. When not using Option Strict and providing a single String as parameter compiler interprets usage as the single Char array method version and method just takes first Char of that string and split by this.
 
Back
Top