By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,569 Members | 1,386 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,569 IT Pros & Developers. It's quick & easy.

convert string to string array

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.