473,385 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

C# @string

How to do it simply:

string ss = @"tab\tnotab\n";

Write.Console(ss); // prints \t \n

How to reinterpret \t and \n

Thank you
Jul 21 '05 #1
4 10060
Remove the @ from the 'ss' string declaration. The @ tells the compiler
that the \t and \n are to be stored literally instead of as tabs and newline
characters respectively.

David

"KrisK" <kk@easylink.com> wrote in message
news:42****************************@phx.gbl...
How to do it simply:

string ss = @"tab\tnotab\n";

Write.Console(ss); // prints \t \n

How to reinterpret \t and \n

Thank you

Jul 21 '05 #2
David I know, but I have string already with \t etc..
and I want it to reinterpreted it (some sort of eval on it)
KK

-----Original Message-----
Remove the @ from the 'ss' string declaration. The @ tells the compilerthat the \t and \n are to be stored literally instead of as tabs and newlinecharacters respectively.

David

"KrisK" <kk@easylink.com> wrote in message
news:42****************************@phx.gbl...
How to do it simply:

string ss = @"tab\tnotab\n";

Write.Console(ss); // prints \t \n

How to reinterpret \t and \n

Thank you

.

Jul 21 '05 #3
Krisk <kk@easylink.com> wrote:
David I know, but I have string already with \t etc..
and I want it to reinterpreted it (some sort of eval on it)


Do something like:

ss = ss.Replace ("\\t", "\t").Replace ("\\r", "\r");
ss = ss.Replace ("\\n", "\n").Replace ("\\\\", "\\");

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Jul 21 '05 #4
Jon,

thank you v. much

you may find this useful, I found it after some search:
System.Reflection.Assembly.GetExecutingAssembly(). GetName
().Version

I dare to say: simple things are most difficult

KK
-----Original Message-----
Krisk <kk@easylink.com> wrote:
David I know, but I have string already with \t etc..
and I want it to reinterpreted it (some sort of eval on
it)
Do something like:

ss = ss.Replace ("\\t", "\t").Replace ("\\r", "\r");
ss = ss.Replace ("\\n", "\n").Replace ("\\\\", "\\");

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
.

Jul 21 '05 #5

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

Similar topics

16
by: Krakatioison | last post by:
My sites navigation is like this: http://www.newsbackup.com/index.php?n=000000000040900000 , depending on the variable "n" (which is always a number), it will take me anywhere on the site......
5
by: Stu Cazzo | last post by:
I have the following: String myStringArray; String myString = "98 99 100"; I want to split up myString and put it into myStringArray. If I use this: myStringArray = myString.split(" "); it...
9
by: John F Dutcher | last post by:
I use code like the following to retrieve fields from a form: recd = recd.append(string.ljust(form.getfirst("lname",' '),15)) recd.append(string.ljust(form.getfirst("fname",' '),15)) etc.,...
9
by: Derek Hart | last post by:
I wish to execute code from a string. The string will have a function name, which will return a string: Dim a as string a = "MyFunctionName(param1, param2)" I have seen a ton of people...
10
by: Angus Leeming | last post by:
Hello, Could someone explain to me why the Standard conveners chose to typedef std::string rather than derive it from std::basic_string<char, ...>? The result of course is that it is...
2
by: Andrew | last post by:
I have written two classes : a String Class based on the book " C++ in 21 days " and a GenericIpClass listed below : file GenericStringClass.h // Generic String class
4
by: Locusta | last post by:
Hello, I have been struggeling for replacing a string in a string. The snippet from the program below replaces the <, & and > with the XML equivalent values. In the program, I allocate space...
29
by: zoro | last post by:
Hi, I am new to C#, coming from Delphi. In Delphi, I am using a 3rd party string handling library that includes some very useful string functions, in particular I'm interested in BEFORE (return...
4
by: Emilio | last post by:
Question about Shared Sub Connect(server As , message As ) Why is in square brackets? Is it like Shared Sub Connect(server() As String, message() As String)
2
by: Badass Scotsman | last post by:
Hello, Using VB and ASP,NET I would like to be able to search a STRING for a smaller STRING within, based on the characters which appear before and after. For example: String1 = " That was...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.