473,511 Members | 15,011 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

string variable shows "@" symbol - why?

Sometimes when I view my string variables in the watch window, it shows an @ symbol preceding the value. Other times, I don't see the @ symbol. What does this mean?
Nov 15 '05 #1
5 5053
Ok, I figured out what the @ symbol means. Now, how do I remove it? I have a string with the @ in front of it and I want to change it to a regular string. I've read this string in with the ResourceManager from a .resx file and I want to use it to format data, using \n as a new line. I can't figure out how to remove the @ symbol

I've tried copying it to another string. I've tried using the String.Format("{0}", oldString), but it always keeps the @ symbol

Nov 15 '05 #2
Why do you want to get rid of it? It is not part of the string. If you
notice, it is outside the quotes which means that it will never interfere
with your string operations.
"br****@novell.com" <an*******@discussions.microsoft.com> wrote in message
news:CB**********************************@microsof t.com...
Ok, I figured out what the @ symbol means. Now, how do I remove it? I have a string with the @ in front of it and I want to change it to a regular
string. I've read this string in with the ResourceManager from a .resx file
and I want to use it to format data, using \n as a new line. I can't figure
out how to remove the @ symbol.
I've tried copying it to another string. I've tried using the String.Format("{0}", oldString), but it always keeps the @ symbol.

Nov 15 '05 #3
In C#, both the following are equivalent representations of "c:\foo\bar":

string strPath = @"c:\foo\bar";
string strPath = "c:\\foo\\bar";

I believe the debugger displayed such strings the 2nd way in version 1.0 of
the framework, and people probably wondered where the extra slashes in the
string came from; so in version 1.1 they switched the display format to make
it plain that the string is to be taken literally. The fact that the @ is
outside the quotes tells you it's not part of the string.

--Bob

"br****@novell.com" <an*******@discussions.microsoft.com> wrote in message
news:CB**********************************@microsof t.com...
Ok, I figured out what the @ symbol means. Now, how do I remove it? I have a string with the @ in front of it and I want to change it to a regular
string. I've read this string in with the ResourceManager from a .resx file
and I want to use it to format data, using \n as a new line. I can't figure
out how to remove the @ symbol.
I've tried copying it to another string. I've tried using the String.Format("{0}", oldString), but it always keeps the @ symbol.

Nov 15 '05 #4
>2. Be able to change from an "@" string to a non-"@" string.

Hi Bruce,

If "MyVerbatimString" is @"Hello Cruel World",

I do:

MyNewString = System.Text.RegularExpressions.Regex.Unescape(MyVe rbatimString);

MyNewString should return "Hello Cruel World" WITHOUT the preceding "@".
This gave me a headache too, until I found this way around it.
Hope this helps,
Wobbles
Nov 15 '05 #5
>Hooray! This solved it! Thanks a million.
- Bruce


Hi Bruce,

Glad I could help.
In fact I think that's the first time I've been of any use!
Nov 15 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
10443
by: PK9 | last post by:
I have a string variable that holds the equivalent of a DateTime value. I pulled this datetime from the database and I want to strip off the time portion before displaying to the user. I am...
3
3584
by: Eric Theil | last post by:
I'm at my wit's end with this one. Within an xsl:if test, I'm not able to get 2 variables to properly evaluate if one of them is wrapped within a string function. <!-- This works --> <xsl:if...
2
9067
by: Lu | last post by:
Hello, I am wondering how to protect a global variable in a header file from external access. So I googled and found: "The keyword 'static' has two different uses, depending on whether it is...
8
4827
by: Peter Merwood | last post by:
I'm using some sample code from MSDN. The code includes the following statement: Dim content as = .Empty I'm not familiar with the use of the square brackets. Can someone please explain to...
2
6506
by: zafzal | last post by:
Hello all, I have a textbox in my asp.net (vb.net) aplicattion, I need to assign it's value to a Variable of type DATE, but it's not a required field, so sometimes I want to send a blank...
9
3070
by: axs221 | last post by:
I am trying to move some of our large VBA Access front-end file into ActiveX DLL files. I created two DLL files so far, one was a module that contains code to integrate into the QuickBooks...
26
2735
by: anonieko | last post by:
In the past I always used "" everywhere for empty string in my code without a problem. Now, do you think I should use String.Empty instead of "" (at all times) ? Let me know your thoughts.
232
13066
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
7
2906
by: php_mysql_beginer911 | last post by:
Hi .. hope someone will help i am trying to figure it out why i cannot post string "union select" every time i try to post data which content union and select .. the page doesn't get posted and...
0
7144
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
7356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7085
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
7512
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
5069
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
4741
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
1577
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
785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
449
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.