-
December 16th, 2005, 05:19 AM
#1
How to insert " in a string
Hi,
How would I insert a double quote <"> in a string in C#?
I want to have a string which include a " inside......but I get compile error for below code:
string st = "abc" + ""1"";
Thanks if anyone can help.
-
December 16th, 2005, 05:26 AM
#2
Re: How to insert " in a string
You have to escape the quotes.
Code:
string st = "abc" + "\"1\"";
Useful or not? Rate my posting. Thanks.
-
December 16th, 2005, 05:28 AM
#3
Re: How to insert " in a string
Try searching the c# forum for similar threads and you will find what you need:
http://www.codeguru.com/forum/showthread.php?t=367673
-
December 16th, 2005, 07:21 AM
#4
Re: How to insert " in a string
Code:
string st = @"abc""1"""
Last edited by jhammer; December 16th, 2005 at 07:29 AM.
-
December 16th, 2005, 01:33 PM
#5
Re: How to insert " in a string
Originally Posted by jhammer
Code:
string st = @"abc""1"""
Dont' forget a semi-colon at the end
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|