Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
tools
vsnet.act
vsnet.debugging
vsnet.documentation
vsnet.enterprise.tools
vsnet.general
vsnet.ide
vsnet.jlca
vsnet.servicepacks
vsnet.setup
vsnet.vsip
vsnet.vss
vsnet.vstools.office
vstudio.development
vstudio.extensibility
vstudio.general
vstudio.helpauthoring
vstudio.setup
vstudio.sourcesafe
  
 
date: Thu, 7 Aug 2008 11:21:48 -0400,    group: microsoft.public.vstudio.general        back       


Using emdash (char(151)) in C# applications   
Hello. I'm writing an application that needs to set the value of a string to 
an emdash (-) (U+2014). I looked at the documentation on the Char structure 
to see if I could find something that would accept the character code (e.g. 
151 or hex 2014) and return the corresponding string, but I couldn't find 
anything useful.

What am I missing?

Thanks,
Darryl R.
date: Thu, 7 Aug 2008 11:21:48 -0400   author:   DarrylR

Re: Using emdash (char(151)) in C# applications   
DarrylR wrote:
> Hello. I'm writing an application that needs to set the value of a string to 
> an emdash (-) (U+2014). I looked at the documentation on the Char structure 
> to see if I could find something that would accept the character code (e.g. 
> 151 or hex 2014) and return the corresponding string, but I couldn't find 
> anything useful.

With C# you can use \u2014 in a string literal e.g.
   string s = "\u2014";
Or you can use the same escape mechanism in a character literal e.g.
   char c = '\u2014';
You can also cast the int value (8212 is 0x2014) to a char e.g.
   char c = (char)8212;


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
date: Sun, 17 Aug 2008 14:16:00 +0200   author:   Martin Honnen

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us