By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,672 Members | 1,644 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,672 IT Pros & Developers. It's quick & easy.

How to print special character in C#?

P: n/a
I want to print a string value that represent temperature.
how to print the 'little superscript circle' in C#?
thx...
Nov 15 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
Amuro wrote:
I want to print a string value that represent temperature.
how to print the 'little superscript circle' in C#?


Example:

Console.WriteLine("\x00B0");

HTH,

Michael

--
Michael Kremser
http://great.dynu.com/

Nov 15 '05 #2

P: n/a
using System;
using System.Collections;

public class MyClass
{
public static void Main()
{
Console.WriteLine("Hello, World! \u00b0");
Console.ReadLine();
}
}

--
/jop
"Amuro" <am***@hotmail.com> wrote in message
news:e4**************@tk2msftngp13.phx.gbl...
I want to print a string value that represent temperature.
how to print the 'little superscript circle' in C#?
thx...

Nov 15 '05 #3

P: n/a
Well ALT+176 worked in some programs but not in most. You could always
copy/paste from this -> <- For use with C or F. There are also unicode
characters that are prebuilt with the degree symbol.

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Nov 15 '05 #4

P: n/a
Amuro <am***@hotmail.com> wrote:
I want to print a string value that represent temperature.
how to print the 'little superscript circle' in C#?


The principle is the same as for all characters: find the Unicode
character on unicode.org, and then embed it appropriately in your code
(eg using a \uxxxx escape sequence).

http://www.unicode.org/charts/charindex.html is a good starting point -
but you do need to have a reasonable idea of the name of the character.
In this case, I would search for "degree" which actually finds (at
least) 4 characters:

Degree celsius: 2103
Degree fahrenheit: 2109
Degree kelvin: 212a
Degree sign: 00b0

Of course, they may well all be represented by the same glyph.

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

P: n/a
Jon Skeet wrote:
The principle is the same as for all characters: find the Unicode
character on unicode.org, and then embed it appropriately in your code
(eg using a \uxxxx escape sequence).


Or you're starting 'charmap' and look it up in the status bar.

Best regards,

Michael

--
Michael Kremser
http://great.dynu.com/

Nov 15 '05 #6

P: n/a
> Degree celsius: 2103
Degree fahrenheit: 2109
Degree kelvin: 212a
Degree sign: 00b0


Except, there is no such thing as degree kelvin, just kelvin. ;) But
that's another story.

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Nov 15 '05 #7

P: n/a
Morten Wennevik wrote:
Except, there is no such thing as degree kelvin, just kelvin. ;) But
that's another story.


Yeah, right. :) Most people don't know this.

Best regards,

Michael

--
Michael Kremser
http://great.dynu.com/

Nov 15 '05 #8

P: n/a
Michael Kremser <us****************@aon.at> wrote:
Except, there is no such thing as degree kelvin, just kelvin. ;) But
that's another story.


Yeah, right. :) Most people don't know this.


Including the folks at the Unicode Consortium, by the looks of it :)

(On the other hand, it's probably the simplest way of registering the
name so that people will find it.)

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

P: n/a
Jon Skeet wrote:
Except, there is no such thing as degree kelvin, just kelvin. ;) But
that's another story.


Yeah, right. :) Most people don't know this.

Including the folks at the Unicode Consortium, by the looks of it :)


Yes, which is questionable. You couldn't say "meter degree" or "pound
degree" as well, that'd be the same nonsense.

Best regards,

Michael

--
Michael Kremser
http://great.dynu.com/

Nov 15 '05 #10

P: n/a
Thx all!

"Amuro" <am***@hotmail.com> wrote in message
news:e4**************@tk2msftngp13.phx.gbl...
I want to print a string value that represent temperature.
how to print the 'little superscript circle' in C#?
thx...

Nov 15 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.