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

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 StringArrayConverter 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 35981
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 StringArrayConverter 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 StringArrayConverter 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 StringArrayConverter 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 StringArrayConverter 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
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
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...
2
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
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...
6
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...
15
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
by: Julia | last post by:
Hi, I need to convert unicode string to ansi string Thanks in adavance.
3
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 =...
2
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
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. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.