4

Following Code:

string a = "Adding substring" + "\xB2";
Console.Write(a);

Will give : "Adding substring2". 2 will be superscript as expected.

How can I do the same with number 3.

Habib
  • 219,104
  • 29
  • 407
  • 436
someone
  • 105
  • 2
  • 7
  • 1
    Nice post by Jon Skeet - http://stackoverflow.com/questions/6431601/convert-a-string-integer-to-superscript-in-c-sharp – Dayan Feb 17 '14 at 19:11
  • You can find the Unicode codes for all super/subscript characters [here](http://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts) – D Stanley Feb 17 '14 at 19:12
  • If you are running on windows, you can look at the characters in a font with Char Map. – crashmstr Feb 17 '14 at 19:13
  • Please, do not include information about a language used in a question title unless it wouldn't make sense without it. Tags serve this purpose. – Ondrej Janacek Feb 17 '14 at 19:15

2 Answers2

7

Just replace 2 with 3 in "\xB2"

string a = "Adding substring" + "\xB3";
Console.Write(a);

And you will get:

Adding substring³
Habib
  • 219,104
  • 29
  • 407
  • 436
3

The unicode character for superscript-3 is \xB3

BlueRaja - Danny Pflughoeft
  • 84,206
  • 33
  • 197
  • 283