Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 line feed in c#

Author  Topic 

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2008-07-29 : 12:50:08
Hello,

whats the serverside code equivalent for line feed. I know its "\n"

I have a script to replace("\n", "") to remove the line feed on a textbox, but it is not working

I know its VbCrf in VB, but whats it in c# ?

thanks

Ehi

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-07-29 : 12:54:45
Environment.NewLine;

_______________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.0 out!
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2008-07-29 : 15:38:26
Thanks Spirit,
however i have a slight problem, when i run

recepients = recepients.Replace(Environment.NewLine, ",");
or
recepients = recepients.Replace(System.Environment.NewLine, ",");

and in the textbox i put

hello
hello
hello

I get results hello ,hello,hello

There is still a space on the first character. Quite confusing, but other characters are fine.

Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2008-07-29 : 15:57:39
Sorry got it sorted.

I also was trying

recepients = recepients.Replace("\n", ",");
recepients = recepients.Replace("\r", ",");

which both works well.
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-07-29 : 16:02:33
note that Environment.NewLine is preferable to \n or \r

_______________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.0 out!
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2008-07-29 : 20:26:52
Yeah I know. Thanks

I was initially using
recepients = recepients.Replace("\n", ",");

But noticed there was an error. I have corrected it and used

recepients = recepients.Replace(System.Environment.NewLine, ",");
Go to Top of Page
   

- Advertisement -