473,395 Members | 2,783 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,395 software developers and data experts.

Help with spaces in strings

Hi,

I am trying to split a line into a string array. Here's the line of code that's troubling me:

Dim arLogLines As String() = strResult.Split(Convert.ToChar("\n"))
From what I can tell through debugging the code, everything before this line of code works
perfectly. When I get to this line, I get an error stating that the "String must be only one
character long."

What does it mean by this, and how can I remedy the problem?

Thanks,
Roshawn
Nov 23 '05 #1
2 857
Roshawn,

The Visual Basic equivalent to \n is ControlChars.NewLine.

Kerry Moorman
"Roshawn Dawson" wrote:
Hi,

I am trying to split a line into a string array. Here's the line of code that's troubling me:

Dim arLogLines As String() = strResult.Split(Convert.ToChar("\n"))
From what I can tell through debugging the code, everything before this line of code works
perfectly. When I get to this line, I get an error stating that the "String must be only one
character long."

What does it mean by this, and how can I remedy the problem?

Thanks,
Roshawn

Nov 23 '05 #2

"Roshawn Dawson" <ud****@bellsouth.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi,

I am trying to split a line into a string array. Here's the line of code that's troubling me:
Dim arLogLines As String() = strResult.Split(Convert.ToChar("\n"))

I beleive you can do it like this if you're trying to split a line up on
spaces...
Dim arrLogLines as String() = split(strResult, " ")
(There's a split function - as well as the split method of the String class
which you are using.)
Nov 23 '05 #3

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

Similar topics

9
by: hokiegal99 | last post by:
This script works as I expect, except for the last section. I want the last section to actually remove all spaces from the front and/or end of filenames. For example, a file that was named " test ...
13
by: Russell E. Owen | last post by:
I'm trying to launch an application from Python 2.3 on Windows. The application is "ds9" (an image viewer), and is installed in C:\Program Files\ds9\ds9 On unix I just do: os.popen3("ds9") and...
5
by: qwweeeit | last post by:
Hi all, I need to limit as much as possible the lenght of a source line, stripping white spaces (except indentation). For example: .. . max_move and AC_RowStack.acceptsCards ( self,...
4
by: Jay Chan | last post by:
I am trying to export data from a SQLServer database into a text file using a stored procedure. I want to be able to read it and debug it easily; therefore, I want all the columns to indent nicely....
17
by: tommy | last post by:
Hi all, I' m adding strings to some fields in my table via Access. The strings sometimes have trailing spaces and I really need to have it that way, but Access truncates trailing spaces. How can...
135
by: Xah Lee | last post by:
Tabs versus Spaces in Source Code Xah Lee, 2006-05-13 In coding a computer program, there's often the choices of tabs or spaces for code indentation. There is a large amount of confusion about...
40
by: raphfrk | last post by:
I have a program which reads in 3 filenames from the command line prog filename1 filename2 filename3 However, it doesn't work when one of the filenames has spaces in it (due to a directory...
1
by: fatima.issawi | last post by:
Hello, I am creating a web page using c# and asp.net. I am trying to populate a list box by reading text from a file. The text in the file has leading spaces in order to show a hierarchy of...
2
by: Noozer | last post by:
Trying to parse some strings and I could really use some help with a regular expression (and how to test it in php). My sample strings: Bob 1/0/X0 134 128 1 5 ...
4
by: carlos | last post by:
I am working on a regular expression validation for my search page. What I have so far works for most cases, but I would like to fine tune it some. I am new to regular expressions, and I do not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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,...

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.