473,473 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Escape Sequences in Strings

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
3 5704
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

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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Thomas Philips | last post by:
I have been playing around with reading strings with embedded escape sequences from files both using readline() and codecs.open() and have a question.I create a file "test.txt" with exactly one...
6
by: Paul Watson | last post by:
How can I get the escapes from a command line parameter interpreted? The user provides a string on the command line. The string might contain traditional escapes such as \t, \n, etc. It might...
6
by: kartik | last post by:
Escape sequences don't seem to work in strings within list comprehensions: >>> print ] What am I missing? Thank you.
8
by: Joe | last post by:
I'm using Python 2.4 on Windows XP SP2. I'm trying to receive a command line argument that is a newline (\n) Here is the command line to use sample.py "\n" Here is a sample.py script
18
by: Steve Litvack | last post by:
Hello, I have built an XMLDocument object instance and I get the following string when I examine the InnerXml property: <?xml version=\"1.0\"?><ROOT><UserData UserID=\"2282\"><Tag1...
5
by: nummertolv | last post by:
Hi, My application is receiving strings, representing windows paths, from an external source. When using these paths, by for instance printing them using str() (print path), the backslashes are...
4
by: JJ | last post by:
Is there a way of checking that a line with escape sequences in it, has no strings in it (apart from the escape sequences)? i.e. a line with \n\t\t\t\t\t\t\t\r\n would have no string in it a...
3
by: slomo | last post by:
How to read strings cantaining escape character from a file and use it as escape sequences? for example, a file 'unicodes.txt' has contents: \u0050\u0079\u0074\u0068\u006f\u006e Now, ...
10
by: hanaa | last post by:
Hello there. $str="This is \na ball"; echo $str; Is there a way i can make the text to be as is, without expanding the escape sequences. I know that single quoted strings do not expand escape...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.