DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Fri, 3 Aug 2007 13:09:31 -0400,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Steve
          2    Fred Chateau
                 3    Steve
                        4    Jesse Houwing
                 5    Fred Chateau
                 6    Steve
          7    Alexey Smirnov


remove new line characters   
I'm getting a string such as

name1\r\nname2

how can I remove the \r\n and just have the string as 

name1
name2?
Date:Fri, 3 Aug 2007 13:09:31 -0400   Author:  

Re: remove new line characters   
If you remove the new line characters. you're not going to get:

name1
name2

You'll get:

name1 name2

Is that what you want?

-- 
Regards,

Fred Chateau
fchateauAtComcastDotNet

"Steve"  wrote in message 
news:ev8COEf1HHA.1336@TK2MSFTNGP04.phx.gbl...
I'm getting a string such as

name1\r\nname2

how can I remove the \r\n and just have the string as

name1
name2?
Date:Fri, 3 Aug 2007 12:22:53 -0500   Author:  

Re: remove new line characters   
well,
the thing is I need to pass each name into a method so I can get their 
information.

here is what I have.

I have a textbox that a user can enter names in, its a multiline textbox and 
they can enter the names in 2 ways,

1) all on one line and let the textbox wrap them
           -- name1,name2,name3,name4,name5,
               name6 and so on

2) or like this
              name1
              name2
              name3
                    and so on

if they enter like #2 I need to take each name one by one and get their 
information.
"Fred Chateau"  wrote in message 
news:uGr4tLf1HHA.5200@TK2MSFTNGP02.phx.gbl...

> If you remove the new line characters. you're not going to get:
>
> name1
> name2
>
> You'll get:
>
> name1 name2
>
> Is that what you want?
>
> -- 
> Regards,
>
> Fred Chateau
> fchateauAtComcastDotNet
>
> "Steve"  wrote in message 
> news:ev8COEf1HHA.1336@TK2MSFTNGP04.phx.gbl...
> I'm getting a string such as
>
> name1\r\nname2
>
> how can I remove the \r\n and just have the string as
>
> name1
> name2?
> 
Date:Fri, 3 Aug 2007 13:29:36 -0400   Author:  

Re: remove new line characters   
Either way, I would use the Regex.Split() method in 
System.Text.RegularExpressions.

-- 
Regards,

Fred Chateau
fchateauAtComcastDotNet


"Steve"  wrote in message 
news:eE%23raPf1HHA.5992@TK2MSFTNGP02.phx.gbl...

> well,
> the thing is I need to pass each name into a method so I can get their 
> information.
>
> here is what I have.
>
> I have a textbox that a user can enter names in, its a multiline textbox 
> and they can enter the names in 2 ways,
>
> 1) all on one line and let the textbox wrap them
>           -- name1,name2,name3,name4,name5,
>               name6 and so on
>
> 2) or like this
>              name1
>              name2
>              name3
>                    and so on
>
> if they enter like #2 I need to take each name one by one and get their 
> information.
> "Fred Chateau"  wrote in message 
> news:uGr4tLf1HHA.5200@TK2MSFTNGP02.phx.gbl...
>> If you remove the new line characters. you're not going to get:
>>
>> name1
>> name2
>>
>> You'll get:
>>
>> name1 name2
>>
>> Is that what you want?
>>
>> -- 
>> Regards,
>>
>> Fred Chateau
>> fchateauAtComcastDotNet
>>
>> "Steve"  wrote in message 
>> news:ev8COEf1HHA.1336@TK2MSFTNGP04.phx.gbl...
>> I'm getting a string such as
>>
>> name1\r\nname2
>>
>> how can I remove the \r\n and just have the string as
>>
>> name1
>> name2?
>>
>
> 
Date:Fri, 3 Aug 2007 12:40:15 -0500   Author:  

Re: remove new line characters   
Hello Steve,

You can use the split function of Strign to do this.

string[] names = inputString.Split(new char[]{',','\r','\n'}, StringSplitOptions.RemoveEmptyEntries)

Jesse


> well,
> the thing is I need to pass each name into a method so I can get their
> information.
> here is what I have.
> 
> I have a textbox that a user can enter names in, its a multiline
> textbox and they can enter the names in 2 ways,
> 
> 1) all on one line and let the textbox wrap them
> -- name1,name2,name3,name4,name5,
> name6 and so on
> 2) or like this
> name1
> name2
> name3
> and so on
> if they enter like #2 I need to take each name one by one and get
> their
> information.
> "Fred Chateau"  wrote in message
> news:uGr4tLf1HHA.5200@TK2MSFTNGP02.phx.gbl...
>> If you remove the new line characters. you're not going to get:
>> 
>> name1
>> name2
>> You'll get:
>> 
>> name1 name2
>> 
>> Is that what you want?
>> 
>> -- Regards,
>> 
>> Fred Chateau
>> fchateauAtComcastDotNet
>> "Steve"  wrote in message
>> news:ev8COEf1HHA.1336@TK2MSFTNGP04.phx.gbl...
>> I'm getting a string such as
>> name1\r\nname2
>> 
>> how can I remove the \r\n and just have the string as
>> 
>> name1
>> name2?
Date:Fri, 3 Aug 2007 17:45:23 +0000 (UTC)   Author:  

Re: remove new line characters   
OK, I'll have to take a look at that due to I never used it.

do you have an example?

"Fred Chateau"  wrote in message 
news:O5C1aVf1HHA.5532@TK2MSFTNGP02.phx.gbl...

> Either way, I would use the Regex.Split() method in 
> System.Text.RegularExpressions.
>
> -- 
> Regards,
>
> Fred Chateau
> fchateauAtComcastDotNet
>
>
> "Steve"  wrote in message 
> news:eE%23raPf1HHA.5992@TK2MSFTNGP02.phx.gbl...
>> well,
>> the thing is I need to pass each name into a method so I can get their 
>> information.
>>
>> here is what I have.
>>
>> I have a textbox that a user can enter names in, its a multiline textbox 
>> and they can enter the names in 2 ways,
>>
>> 1) all on one line and let the textbox wrap them
>>           -- name1,name2,name3,name4,name5,
>>               name6 and so on
>>
>> 2) or like this
>>              name1
>>              name2
>>              name3
>>                    and so on
>>
>> if they enter like #2 I need to take each name one by one and get their 
>> information.
>> "Fred Chateau"  wrote in message 
>> news:uGr4tLf1HHA.5200@TK2MSFTNGP02.phx.gbl...
>>> If you remove the new line characters. you're not going to get:
>>>
>>> name1
>>> name2
>>>
>>> You'll get:
>>>
>>> name1 name2
>>>
>>> Is that what you want?
>>>
>>> -- 
>>> Regards,
>>>
>>> Fred Chateau
>>> fchateauAtComcastDotNet
>>>
>>> "Steve"  wrote in message 
>>> news:ev8COEf1HHA.1336@TK2MSFTNGP04.phx.gbl...
>>> I'm getting a string such as
>>>
>>> name1\r\nname2
>>>
>>> how can I remove the \r\n and just have the string as
>>>
>>> name1
>>> name2?
>>>
>>
>>
>
> 
Date:Fri, 3 Aug 2007 13:46:28 -0400   Author:  

Re: remove new line characters   
On Aug 3, 7:46 pm, "Steve"  wrote:

> OK, I'll have to take a look at that due to I never used it.
>
> do you have an example?
>


string input = "name1\r\nname2";
foreach(string s in Regex.Split(input,"\r\n"))
{
 other_method(s);
}

More about Regex.Split
http://msdn2.microsoft.com/en-us/library/system.text.regularexpressions.regex.split.aspx

Hope this helps
Date:Fri, 03 Aug 2007 15:46:57 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us