一、HTML中:
如字符串"21st" 想要把st 设置为上标,在html标签中是21<sup>st</sup> 二、C#编辑器中
你可以使用 unicode super/subscripts,如:
var o2 = "O₂";       // or "O\x2082"
var unit2 = "unit²"; // or "unit\xB2"

请参考以下网址中的表格:https://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts

  The most common superscript digits (1, 2, and 3) were in ISO-8859-1 and were therefore carried over into those positions in the Latin-1 range of Unicode. The rest were placed in a dedicated section of Unicode at U+2070 to U+209F. The two tables below show these characters. Each superscript or subscript character is preceded by a normal x to show the subscripting/superscripting. The table on the left contains the actual Unicode characters; the one on the right contains the equivalents using HTML markup for the subscript or superscript. Gray cells are reserved for future use, white cells are other characters from Latin-1.

  你也可以直接复制里面的字符在程序中修改。

Unicode characters
  0 1 2 3 4 5 6 7 8 9 A B C D E F
U+00Bx                          
U+207x x⁰ xⁱ     x⁴ x⁵ x⁶ x⁷ x⁸ x⁹ x⁺ x⁻ x⁼ x⁽ x⁾ xⁿ
U+208x x₀ x₁ x₂ x₃ x₄ x₅ x₆ x₇ x₈ x₉ x₊ x₋ x₌ x₍ x₎  
U+209x xₐ xₑ xₒ xₓ xₔ xₕ xₖ xₗ xₘ xₙ xₚ xₛ xₜ      
Equivalent HTML markup
  0 1 2 3 4 5 6 7 8 9 A B C D E F
U+00Bx     x2 x3           x1            
U+207x x0 xi     x4 x5 x6 x7 x8 x9 x+ x x= x( x) xn
U+208x x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x+ x x= x( x)  
U+209x xa xe xo xx xə xh xk xl xm xn xp xs xt      

Other superscript and subscript characters

Unicode also includes subscript and superscript characters that are intended for semantic usage, in the following blocks:

  • The Latin-1 Supplement block contains the feminine and masculine ordinal indicators ª and º.
  • The Combining Diacritical Marks block contains medieval superscript letter diacritics. These letters are written directly above other letters appearing in medieval Germanic manuscripts, and so these glyphs do not include spacing, for example uͤ. They are shown here over a long string of periods: ....ͣ...ͤ...ͥ...ͦ...ͧ...ͨ...ͩ...ͪ...ͫ...ͬ...ͭ...ͮ...ͯ..
  • The Combining Diacritical Marks Supplement block contains additional medieval superscript letter diacritics, enough to complete the basic lowercase Latin alphabet except for q and y, a few small capitals and ligatures (ae, ao, av), and additional letters.
  • The Spacing Modifier Letters block has superscripted letters and symbols used for phonetic transcription: ʰ ʱ ʲ ʳ ʴ ʵ ʶ ʷ ʸ ˀ ˁ ˠ ˡ ˢ ˣ ˤ.
  • The Phonetic Extensions block has several sub- and super-scripted letters and symbols: ᴬ ᴭ ᴮ ᴯ ᴰ ᴱ ᴲ ᴳ ᴴ ᴵ ᴶ ᴷ ᴸ ᴹ ᴺ ᴻ ᴼ ᴽ ᴾ ᴿ ᵀ ᵁ ᵂ ᵃ ᵄ ᵅ ᵆ ᵇ ᵈ ᵉ ᵊ ᵋ ᵌ ᵍ ᵎ ᵏ ᵐ ᵑ ᵒ ᵓ ᵔ ᵕ ᵖ ᵗ ᵘ ᵙ ᵚ ᵛ ᵜ ᵝ ᵞ ᵟ ᵠ ᵡ ᵢ ᵣ ᵤ ᵥ ᵦ ᵧ ᵨ ᵩ ᵪ ᵸ.
  • The Phonetic Extensions Supplement block has a few more: ᶛ ᶜ ᶝ ᶞ ᶟ ᶠ ᶡ ᶢ ᶣ ᶤ ᶥ ᶦ ᶧ ᶨ ᶩ ᶪ ᶫ ᶬ ᶭ ᶮ ᶯ ᶰ ᶱ ᶲ ᶳ ᶴ ᶵ ᶶ ᶷ ᶸ ᶹ ᶺ ᶻ ᶼ ᶽ ᶾ ᶿ.

Consolidated, the Unicode standard defines complete sub- and super-scripts for numbers and common mathematical symbols ( ⁰ ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ⁺ ⁻ ⁼ ⁽ ⁾ ₀ ₁ ₂ ₃ ₄ ₅ ₆ ₇ ₈ ₉ ₊ ₋ ₌ ₍ ₎ ), a full superscript Latin lowercase alphabet except q ( ᵃ ᵇ ᶜ ᵈ ᵉ ᶠ ᵍ ʰ ⁱ ʲ ᵏ ˡ ᵐ ⁿ ᵒ ᵖ ʳ ˢ ᵗ ᵘ ᵛ ʷ ˣ ʸ ᶻ ), a limited uppercase Latin alphabet ( ᴬ ᴮ ᴰ ᴱ ᴳ ᴴ ᴵ ᴶ ᴷ ᴸ ᴹ ᴺ ᴼ ᴾ ᴿ ᵀ ᵁ ⱽ ᵂ ), a few subscripted lowercase letters ( ₐ ₑ ₕ ᵢ ⱼ ₖ ₗ ₘ ₙ ₒ ₚ ᵣ ₛ ₜ ᵤ ᵥ ₓ ), and some Greek letters ( ᵅ ᵝ ᵞ ᵟ ᵋ ᶿ ᶥ ᶲ ᵠ ᵡ ᵦ ᵧ ᵨ ᵩ ᵪ ). Note that since these characters come from different ranges, they may not be of the same size and position, depending on the typeface.

C#中如何在字符串中设置上标的更多相关文章

  1. 在sqlserver中如何从字符串中提取数字,英文,中文,过滤重复字符

    原文:在sqlserver中如何从字符串中提取数字,英文,中文,过滤重复字符 最近做项目的时候,经常用到一个字符串中的某些字符,处理起来非常的棘手,现在用下面的方法就可以很方便的从字符串中处理你想要的 ...

  2. Android中如何截取字符串中某个字符之前或之后的字符串

    代码改变世界 Android中如何截取字符串中某个字符之前或之后的字符串 //截取#之前的字符串 String str = "sdfs#d"; str.substring(0, s ...

  3. asp.net中C#获取字符串中汉字的个数实例

    符串可以包括数字,字母,汉字或者其他的字符.使用Char类型的IsDigit静态方法可以判断字符串中的字符是否为数字,使用Char类型中的 IsLetter静态方法可以判断字符串中是否为字母.我们来实 ...

  4. Excel中如何提取字符串中的数字

    取字符串中的数字,假如数据在A列,提取公式为 =LOOKUP(9^9,--MID(A1,MIN(FIND({1,2,3,4,5,6,7,8,9,0},A1&5^19)),ROW($1:$99) ...

  5. java中如何忽略字符串中的转义字符--转载

    原文地址:http://my.oschina.net/u/1010578/blog/366252 起因     这几天工作上需要跟另一个同事联调rest接口,我这边是java他是php,返回报文是js ...

  6. Excel中如何截取字符串中指定字符后的部分字符

    1.如何给某列属性为时间整体加一个时间值:      场景一:假如我有一个excel中的某一列如下图所示,如何将该列的时间(用B代替整列)整体加一分钟呢?方法很简单,在空白单元格填写时间格式图中A所示 ...

  7. 20. orcle中统计一个字符串中某个字符的长度

    例子1:统计一个字符串中“,”的个数: select lengthb(regexp_replace('[a,b,c,d,e,f]','[^,]',null))  as res from dual; 例 ...

  8. JSON中如何转义字符串中的双引号(转载)

    问: I'm trying to show double quotes but it shows one of the backslashes: "maingame": { &qu ...

  9. 【HTML】处理<br>换行符追加到前端换行无效的问题 --- html中渲染的字符串中包含HTML标签无效的处理方法,字符串中包含HTML标签被转义的问题 解决

    需求如下图: 追加给前台后,效果如下: 可以在源码看到: 是将后台给出来的数据,直接当作字符串给填充在了前台HTML中. 而查看浏览器编译后的HTML源码可以发现: 原来字符串中的<br> ...

随机推荐

  1. MVP社区巡讲照片集

    今天MVP社区巡讲在北京利星行微软大厦连同SQL PASS社区合办了一次线下活动,这次互动汇集了在北京大多数的微软MVP,他们都是微软认可的有着各微软产品和技术特长的技术专家,无论是MVP社区巡讲还是 ...

  2. Java后端WebSocket的Tomcat实现

    转自:http://blog.chenzuhuang.com/archive/28.html 文章摘要随着互联网的发展,传统的HTTP协议已经很难满足Web应用日益复杂的需求了.近年来,随着HTML5 ...

  3. visio调整画布大小和旋转画布(转)

    1.调整画布大小: 鼠标移至画布边界(注意不能是顶点附近),按下ctrl,就会出现双向箭头,拖动鼠标即能调整画布大小. 2.旋转画布: 鼠标移至画布顶点或附近,按下ctrl, 出现单箭头优弧,移动鼠标 ...

  4. windows内核需要注意的

    修改windows内核函数 先屏蔽KdPrint 测试. Hook函数一律使用全局变量 妹的..KiTrap0E 修改.触发了已经断点.但是硬件断点Hook函数里只要使用KdPrint 就蓝屏

  5. CF735C 数论\平衡树叶子节点的最大深度\贪心\斐波那契\条件归一化

    http://codeforces.com/problemset/problem/735/C 题意..采用淘汰赛制..只要打输就退出比赛..而且只有两个选手打过的场数 相差不超过1才能比赛..最后问你 ...

  6. jq获取后台json并解析

    参考: $(function () { $.ajax({ url: 'tsconfig.json', type: 'GET', dataType: 'json', timeout: 1000, cac ...

  7. Quartz.NET配置

    概述 Quartz.NET 在开源任务调度框架中的翘首,它提供了强大任务调度机制,难能可贵的是它同时保持了使用的简单性.Quartz 允许开发人员灵活地定义触发器的调度时间表,并可以对触发器和任务进行 ...

  8. string、math、random、datetime类

    1.string类 变量.Replace("想要替换掉的字符或字符串","转换后的字符或字符串");//替换 练习:判断邮箱格式是否正确            ...

  9. banner无限轮播

    activity_main.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayou ...

  10. 【转】Spark-Sql版本升级对应的新特性汇总

    Spark-Sql版本升级对应的新特性汇总 SparkSQL的前身是Shark.由于Shark自身的不完善,2014年6月1日Reynold Xin宣布:停止对Shark的开发.SparkSQL抛弃原 ...