 |
| C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

January 7th, 2006, 12:50 AM
|
|
Authorized User
|
|
Join Date: Dec 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
escape squences in C#
Experts,
I am not able to use escape sequences in C#.
Example i am trying to say :-
string str = "hi i am in \"double quotes\". \n new line \t tabing";
Response.Write(str);
so result i am getting is:-
hi i am in "double quotes". new line tabing
so \n and \t sequence is not working, but \" is working fine.
Don't know what is the reason ?
KG
__________________
KG
|
|

January 7th, 2006, 05:09 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Looking at the Response.Write, it appears you're using this in a web app.
I think that \n and \t ARE applied, but it's not visible on screen. If you look at the resulting HTML source in the browser,you'll see the source is formatted as expected. To have these characters appear on screen as well, use <br /> instead of \n.
\t (tab) can be solved in a different way; one is using multiple successive " " sequences.
HtH,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

January 8th, 2006, 10:51 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Even multiple " " may not be sufficient. You may need several " ". The browser usually ignores many " " in sequence and reduces them to a single " ".
- Peter
|
|

January 8th, 2006, 10:59 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
I think I had that, but the was changed by the forum....
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

January 9th, 2006, 03:31 AM
|
|
Authorized User
|
|
Join Date: Dec 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
quote:Originally posted by Imar
Looking at the Response.Write, it appears you're using this in a web app.
I think that \n and \t ARE applied, but it's not visible on screen. If you look at the resulting HTML source in the browser,you'll see the source is formatted as expected. To have these characters appear on screen as well, use <br /> instead of \n.
\t (tab) can be solved in a different way; one is using multiple successive " " sequences.
HtH,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
Imar, I used <br> its working fine with IE.
But actually i am creating oen link, on click of that link opening outlook with all the email details. like cc, bcc, subject and body.
Problem is outlook is taking <br> as part of the string not as a new line. So i want to have a formatted email in the Outlook send page.
How can i do that ??
Tnx,
KG
|
|

January 9th, 2006, 01:22 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Does Outlook understand the \r\n construct?
The <br /> is used in the browser but apparently Outlook has trouble understanding that. If \r\n doesn't work, I am not sure that what you want is possible...
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

January 10th, 2006, 12:21 AM
|
|
Authorized User
|
|
Join Date: Dec 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
\r\n is not working....
KG
|
|

January 10th, 2006, 10:24 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
Take a look at this ancient post I made in the past at p2p.wrox.com
It's over 5 years old, so it probably won't work anymore with more intelligent privacy aware mail applications like Outlook, but it's worth a try...
http://p2p.wrox.com/archive/html_cod.../2000-12/6.asp
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|
 |