|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
convert string to string arrayI 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 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...) Show quoteHide quote > 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 Thanks...that worked and I used trim to remove the carriage return.
K S Kachru wrote: Show quoteHide quote > 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 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/microsoft.public.dotnet.languages.csharp/tree/browse_frm/thread/c6042f6ce5d418ab/3ba155249e87e5e0?rnum=1&_done=%2Fgroup%2Fmicrosoft.public.dotnet.languages.csharp%2Fbrowse_frm%2Fthread%2Fc6042f6ce5d418ab%2Feb5b783def1f282e%3F#doc_3ba155249e87e5e0 and see this http://groups.google.com/groups/search?q=dotnet+search+string k> I have multiline textbox and I am trying to do a search functionality k> based on the input entered in this Textbox. I am able to convert into k> a string array if the search components are separated by commas, for k> ex (Image1, Image2) by using the StringArrayConverter class available k> in .Net 2.0. But I also want to convert the strings entered in new k> line for example if I enter k> k> Image1 k> Image2 k> I want to convert this into a string array too, I used the split k> funtcion but it takes null value between two strings If I don't pass k> any delimiter. k> k> Can anybody please help me with this. k> k> Thanks k> K --- 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 Thanks
K Michael Nemtsev wrote: Show quoteHide quote > 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/microsoft.public.dotnet.languages.csharp/tree/browse_frm/thread/c6042f6ce5d418ab/3ba155249e87e5e0?rnum=1&_done=%2Fgroup%2Fmicrosoft.public.dotnet.languages.csharp%2Fbrowse_frm%2Fthread%2Fc6042f6ce5d418ab%2Feb5b783def1f282e%3F#doc_3ba155249e87e5e0 > > and see this http://groups.google.com/groups/search?q=dotnet+search+string > > k> I have multiline textbox and I am trying to do a search functionality > k> based on the input entered in this Textbox. I am able to convert into > k> a string array if the search components are separated by commas, for > k> ex (Image1, Image2) by using the StringArrayConverter class available > k> in .Net 2.0. But I also want to convert the strings entered in new > k> line for example if I enter > k> > k> Image1 > k> Image2 > k> I want to convert this into a string array too, I used the split > k> funtcion but it takes null value between two strings If I don't pass > k> any delimiter. > k> > k> Can anybody please help me with this. > k> > k> Thanks > k> K > --- > 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 "Michael Nemtsev" <nemt***@msn.com> wrote in message None of the methods mentioned in these articles will have any advantage when news:1799a79b3aac218c8a0e2ea22157a@msnews.microsoft.com... > 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/microsoft.public.dotnet.languages.csharp/tree/browse_frm/thread/c6042f6ce5d418ab/3ba155249e87e5e0?rnum=1&_done=%2Fgroup%2Fmicrosoft.public.dotnet.languages.csharp%2Fbrowse_frm%2Fthread%2Fc6042f6ce5d418ab%2Feb5b783def1f282e%3F#doc_3ba155249e87e5e0 > > and see this http://groups.google.com/groups/search?q=dotnet+search+string searching for a single character separator, in this case '\n'. Hello Ben,
there is description of how to search substrings, not the \n separator Show quoteHide quote BV> "Michael Nemtsev" <nemt***@msn.com> wrote in message BV> None of the methods mentioned in these articles will have anyBV> news:1799a79b3aac218c8a0e2ea22157a@msnews.microsoft.com... BV> >> 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/microsoft.public.dotnet.languages.csha >> rp/tree/browse_frm/thread/c6042f6ce5d418ab/3ba155249e87e5e0?rnum=1&_d >> one=%2Fgroup%2Fmicrosoft.public.dotnet.languages.csharp%2Fbrowse_frm% >> 2Fthread%2Fc6042f6ce5d418ab%2Feb5b783def1f282e%3F#doc_3ba155249e87e5e >> 0 >> >> and see this >> http://groups.google.com/groups/search?q=dotnet+search+string >> BV> advantage when searching for a single character separator, in this BV> case '\n'. BV> --- WBR, Michael Nemtsev :: blog: http://spaces.live.com/laflour "At times one remains faithful to a cause only because its opponents do not cease to be insipid." (c) Friedrich Nietzsche
Creating Events
how to prohibit writing to a collection by other threads ? Delegate Question: How does it know? Queue.Contains(myobj) return always false.. Help with Exception handling Selecting a PictureBox Interop - string from dll issue Finding Current/Active Session ID Gettin started with C# creating 2 indexers in dotnet 2? |
|||||||||||||||||||||||