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

Escape Sequences in Strings

P: n/a
Ken
HI:

I'm reading a string that will be displayed in a MessageBox from a resource
file. The string in the resource file contains escape sequences so they
will be broken up into multiple lines. e.g. This is line 1\n\nThis is line
2. When this string is read using a ResourceManager GetString method the
string is returned @-quoted, i.e as if I entered the literal @"This is
line1\n\nThis is line 2", causing the escape sequences not to be processed.
Is there any way around this. I have not been able to find a work around or
setting that can be used so the escape sequences will be processed.

Thanks in advance

Ken Denault
Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
im not so sure but try to do 'Line1\n\rLine2'

regards,
--
gani
pls visit: http://thedeveloperscorner.com.ph

"Ken" <kd******@charter.net> wrote in message
news:vm************@corp.supernews.com...
HI:

I'm reading a string that will be displayed in a MessageBox from a resource file. The string in the resource file contains escape sequences so they
will be broken up into multiple lines. e.g. This is line 1\n\nThis is line 2. When this string is read using a ResourceManager GetString method the
string is returned @-quoted, i.e as if I entered the literal @"This is
line1\n\nThis is line 2", causing the escape sequences not to be processed. Is there any way around this. I have not been able to find a work around or setting that can be used so the escape sequences will be processed.

Thanks in advance

Ken Denault

Nov 15 '05 #2

P: n/a

Hi Ken,

Can you show me why you need the \n\n to be parsed?
If you want to display it such as in messagebox, you can
just pass this string to the method, it will be parsed.
MessageBox.Show("This is line1\n\nThis is line 2"), the string
will be parsed.

Btw: \n\n is 2 newline escape character.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Ken" <kd******@charter.net>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Subject: Escape Sequences in Strings
| Date: Mon, 22 Sep 2003 18:01:06 -0400
| Organization: Posted via Supernews, http://www.supernews.com
| Message-ID: <vm************@corp.supernews.com>
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| X-Complaints-To: ab***@supernews.com
| Lines: 16
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-onlin
e.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-01!sn-
post-01!supernews.com!corp.supernews.com!not-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:186644
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| HI:
|
| I'm reading a string that will be displayed in a MessageBox from a
resource
| file. The string in the resource file contains escape sequences so they
| will be broken up into multiple lines. e.g. This is line 1\n\nThis is
line
| 2. When this string is read using a ResourceManager GetString method the
| string is returned @-quoted, i.e as if I entered the literal @"This is
| line1\n\nThis is line 2", causing the escape sequences not to be
processed.
| Is there any way around this. I have not been able to find a work around
or
| setting that can be used so the escape sequences will be processed.
|
| Thanks in advance
|
| Ken Denault
|
|
|

Nov 15 '05 #3

P: n/a
Ken
You are correct in that if it is passed to MessageBox.Show as a hard coded
string it will do as I would like. The issue is that I'm putting all my
messages in a resource file so they can be changed without rebuilding the
application. So when the resource is read by the ResourceManager it is read
as a quoted string.

Thanks

Ken

"Jeffrey Tan[MSFT]" <v-*****@online.microsoft.com> wrote in message
news:9l*************@cpmsftngxa06.phx.gbl...

Hi Ken,

Can you show me why you need the \n\n to be parsed?
If you want to display it such as in messagebox, you can
just pass this string to the method, it will be parsed.
MessageBox.Show("This is line1\n\nThis is line 2"), the string
will be parsed.

Btw: \n\n is 2 newline escape character.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Ken" <kd******@charter.net>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Subject: Escape Sequences in Strings
| Date: Mon, 22 Sep 2003 18:01:06 -0400
| Organization: Posted via Supernews, http://www.supernews.com
| Message-ID: <vm************@corp.supernews.com>
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| X-Complaints-To: ab***@supernews.com
| Lines: 16
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-onlin e.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-01!sn- post-01!supernews.com!corp.supernews.com!not-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:186644 | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| HI:
|
| I'm reading a string that will be displayed in a MessageBox from a
resource
| file. The string in the resource file contains escape sequences so they
| will be broken up into multiple lines. e.g. This is line 1\n\nThis is
line
| 2. When this string is read using a ResourceManager GetString method the | string is returned @-quoted, i.e as if I entered the literal @"This is
| line1\n\nThis is line 2", causing the escape sequences not to be
processed.
| Is there any way around this. I have not been able to find a work around or
| setting that can be used so the escape sequences will be processed.
|
| Thanks in advance
|
| Ken Denault
|
|
|

Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.