473,410 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

Split text into an array

I have a multine list that I would like to split into an array. I paste it
into a richtext box and go from there, but it just makes the first part of
the array the whole list with little boxes inbetween. Here is the code

Dim userdata As String

Dim serverarray As String()

Dim servercount As Integer

userdata = RichTextBox1.Text

serverarray = userdata.Split(vbCrLf)

Console.WriteLine(serverarray(0))
Nov 21 '05 #1
3 2484
Microsoft wrote:
I have a multine list that I would like to split into an array. I paste it
into a richtext box and go from there, but it just makes the first part of
the array the whole list with little boxes inbetween. Here is the code

Dim userdata As String

Dim serverarray As String()

Dim servercount As Integer

userdata = RichTextBox1.Text

serverarray = userdata.Split(vbCrLf)

Console.WriteLine(serverarray(0))

The delimeter for your lines might NOT be both a vbCr (carriage return)
and a vbLf (line feed); it could also be one or the other.

I would venture a guess that your line is delimited by vbLf's...try
splitting on that instead and see if you get the desired results.

HTH...
Chris
Nov 21 '05 #2
That was exactly the issue .. Thank you!

Is there any way to easily tell what delimiter is being used in the future?

THe code works great when the user pastes from a text editor, but when they
paste from Exel, each entry seems to have a tab after it. Any easy way to
make sure that the data is text and convert it if its not. I am not have
any luick with idata..
"Chris Hyde" <ch*****@nodirecwayspam.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Microsoft wrote:
I have a multine list that I would like to split into an array. I paste it into a richtext box and go from there, but it just makes the first part of the array the whole list with little boxes inbetween. Here is the code

Dim userdata As String

Dim serverarray As String()

Dim servercount As Integer

userdata = RichTextBox1.Text

serverarray = userdata.Split(vbCrLf)

Console.WriteLine(serverarray(0))

The delimeter for your lines might NOT be both a vbCr (carriage return)
and a vbLf (line feed); it could also be one or the other.

I would venture a guess that your line is delimited by vbLf's...try
splitting on that instead and see if you get the desired results.

HTH...
Chris

Nov 21 '05 #3
Hello...

http://www.ftponline.com/vsm/2004_11...ns/net2themax/
article titled: Parse Text Files With Regular Expressions

Marc Cramer

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Brian Glen Palicia | last post by:
My goal is to accept input from the user into a text box and then parse the data using split(). The first step is this tiny program to test the split() function. It runs in IE, but in Mozilla it...
1
by: jhcorey | last post by:
I don't know where the actual issue is, but hopefully someone can explain. The following displays "5" in FireFox, but "3" in IE: <script type="text/javascript" language="javascript"> var...
1
by: Krish | last post by:
I have requirement, that i get one big chunk of text file. This text file will have has information, that on finding "****End of Information****", i have to split them individual text file with our...
3
by: Jan Hanssen | last post by:
Hi! I have a list of data in a textfile which is tab delimited. Each line is seperated by a VbCrLf. I want to collect this data in a multidimensional string array. I do not wish to use a...
4
by: Craig Buchanan | last post by:
I am trying to split a comma-delimited string into a string array. unfortunately, if the string doesn't contain a comma, the resulting array is Nothing. other than using vb6 compatibility, is...
3
by: Ben | last post by:
Hi I am creating a dynamic function to return a two dimensional array from a delimeted string. The delimited string is like: field1...field2...field3... field1...field2...field3......
6
by: Saurabh | last post by:
Hi everyone, I am looking for some expert advise to get me out of trouble. I am looking for a solution in C# which will allow me to split the below string in the format provided. The...
3
by: edoardo.poeta | last post by:
I'm a dummy. I have a basic knowledge of javascript and I want to split a string, but I receive an error at line 15. Where my error in make the array? Why? Can someone help me to resolve? Thank's....
12
by: garyusenet | last post by:
string lines = File.ReadAllLines(@"c:\text\history.txt"); foreach (string s in lines) { ArrayList results = new ArrayList(); string delimit = ";"; string currentline = s.Split(";"); ...
2
by: sicario | last post by:
Hi, givens lines of text such as: the cat sat on the mat the <var> sat on the mat the <var> sat on the <my object> the <var> sat on the <my object> and <action taken by cat> I want to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.