473,796 Members | 2,488 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

convert string to string array

I have multiline textbox and I am trying to do a search functionality
based on the input entered in this Textbox. I am able to convert into a
string array if the search components are separated by commas, for ex
(Image1, Image2) by using the StringArrayConv erter class available in
..Net 2.0. But I also want to convert the strings entered in new line
for example if I enter

Image1
Image2

I want to convert this into a string array too, I used the split
funtcion but it takes null value between two strings If I don't pass
any delimiter.

Can anybody please help me with this.

Thanks
K

Sep 7 '06 #1
4 36021
Try this...

string[] arr = s.Split(new char[] { '\n' });

where s is your string.

(I think split function takes in a character also, but my compiler is complaining...)

I have multiline textbox and I am trying to do a search functionality
based on the input entered in this Textbox. I am able to convert into
a string array if the search components are separated by commas, for
ex (Image1, Image2) by using the StringArrayConv erter class available
in .Net 2.0. But I also want to convert the strings entered in new
line for example if I enter

Image1
Image2
I want to convert this into a string array too, I used the split
funtcion but it takes null value between two strings If I don't pass
any delimiter.

Can anybody please help me with this.

Thanks
K

Sep 7 '06 #2
Hello kvicky,

I don't think that is the good approach to look substring
I recommend u to read this http://groups.google.com/group/micro...a155249e87e5e0

and see this http://groups.google.com/groups/sear...+search+string

kI have multiline textbox and I am trying to do a search functionality
kbased on the input entered in this Textbox. I am able to convert into
ka string array if the search components are separated by commas, for
kex (Image1, Image2) by using the StringArrayConv erter class available
kin .Net 2.0. But I also want to convert the strings entered in new
kline for example if I enter
k>
kImage1
kImage2
kI want to convert this into a string array too, I used the split
kfuntcion but it takes null value between two strings If I don't pass
kany delimiter.
k>
kCan anybody please help me with this.
k>
kThanks
kK
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Sep 7 '06 #3
Thanks...that worked and I used trim to remove the carriage return.

K

S Kachru wrote:
Try this...

string[] arr = s.Split(new char[] { '\n' });

where s is your string.

(I think split function takes in a character also, but my compiler is complaining...)

I have multiline textbox and I am trying to do a search functionality
based on the input entered in this Textbox. I am able to convert into
a string array if the search components are separated by commas, for
ex (Image1, Image2) by using the StringArrayConv erter class available
in .Net 2.0. But I also want to convert the strings entered in new
line for example if I enter

Image1
Image2
I want to convert this into a string array too, I used the split
funtcion but it takes null value between two strings If I don't pass
any delimiter.

Can anybody please help me with this.

Thanks
K
Sep 7 '06 #4
Thanks

K

Michael Nemtsev wrote:
Hello kvicky,

I don't think that is the good approach to look substring
I recommend u to read this http://groups.google.com/group/micro...a155249e87e5e0

and see this http://groups.google.com/groups/sear...+search+string

kI have multiline textbox and I am trying to do a search functionality
kbased on the input entered in this Textbox. I am able to convert into
ka string array if the search components are separated by commas, for
kex (Image1, Image2) by using the StringArrayConv erter class available
kin .Net 2.0. But I also want to convert the strings entered in new
kline for example if I enter
k>
kImage1
kImage2
kI want to convert this into a string array too, I used the split
kfuntcion but it takes null value between two strings If I don't pass
kany delimiter.
k>
kCan anybody please help me with this.
k>
kThanks
kK
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Sep 7 '06 #5

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

Similar topics

3
273
by: Tome73 | last post by:
How would I convert this string to an Array? "243, 567, 324, 345" Where each number becomes a new element in that Array. Thanks
27
51736
by: Trep | last post by:
Hi there! I've been having a lot of difficult trying to figure out a way to convert a terminated char array to a system::string for use in Visual C++ .NET 2003. This is necessary because I have some legcay C code that needs to process a string taken from a textbox, then I need to re-display the string as the textbox->Text. I easily found how to convert from system::string to char but I can't figure out how to go the other way!!
2
10677
by: Venkat | last post by:
Hi All, Can someone tell me how do we convert a character array to string. I know the other way. For eg:- String strvar = "hello"; printf("%s",strvar.c_str()); regards,
2
2496
by: Brian | last post by:
I have a string that I received from a web service call and I want to write it to a Stream. I cannot figure out how to access the string as a byte array and write it to the Stream. Any thoughts. I looked at Byte.Parse() but it will only convert a string represntation of a number and convert it to a byte. Thanks, Brian
6
10233
by: Ricardo Quintanilla | last post by:
i have a code that sends data to a socket listening over as400 platform, the socket responds to me as a "byte array". then i need to convert the "byte array" into a string. the problem is that the data converted from the byte array into a string , is not what i expect. example: - the data returned from the socket is (byte array) "Usuario Sin Atribuciones Para Esta Función"
15
34610
by: Kueishiong Tu | last post by:
How do I convert a Byte array (unsigned char managed) to a char array(unmanaged) with wide character taken into account?
4
79658
by: Julia | last post by:
Hi, I need to convert unicode string to ansi string Thanks in adavance.
3
3652
by: David | last post by:
Hi, how to convert a char array(byte) to a string variable? byte buffer; string strTest; /*the blow codes all get type of 'buffer': System.Byte! strTest = buffer.ToString() strTest = System.Convert.ToString(buffer)
2
1332
by: AMP | last post by:
Hello, I want to convert a string Array permanantly to a int Array. Everywhere in my code I have to use Convert.ToInt32 to use the data. I just want to change it once. Thanks Mike
5
4854
by: da1978 | last post by:
Hi experts, I need to convert a string or a Byte array to a string byte array. Its relatively easy to convert a string to an char array or a byte array but not a STRING byte array. i.e. Dim Array() As Char Dim strwork As String = "76A3kj9d6" Array = strwork.ToCharArray OR
0
9683
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9529
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10457
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10231
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10176
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10013
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9054
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5576
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3733
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.