C#中如何在字符串中设置上标

时间:2023-02-25 20:57:44
一、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&period;net中C&num;获取字符串中汉字的个数实例

    符串可以包括数字,字母,汉字或者其他的字符.使用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&period; 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】处理&lt&semi;br&gt&semi;换行符追加到前端换行无效的问题 --- html中渲染的字符串中包含HTML标签无效的处理方法,字符串中包含HTML标签被转义的问题 解决

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

随机推荐

  1. 如何更改java应用程序标题栏默认图标

    方法一: 如果你用过Toolkit类,这将是一件很简单的事情: Toolkit tk=Toolkit.getDefaultToolkit() Image image=tk.createImage(&q ...

  2. Phoenix - Hbase与SQL

    Phoenix - Hbase与SQL 2016-10-23 杜亦舒 Phoenix是什么 简单来说,Phoenix 是一个可以让我们通过SQL的方式操作HBase数据库的框架. HBase是一个No ...

  3. 第六十八篇、OC&lowbar;按照某一字段对数值进行排序

    代码中是根据"create_time_" 进行排序   ascending:决定的是升序还是降序排序 NSSortDescriptor *sortDescriptor = [[NS ...

  4. 服务控件与html标签的一点

    前言 很久没有用服务器控件开发了,在新公司待了三四个月了,这个公司一直都用服务器控件.所以在开发的过程中也发现了一丢丢的东东,也许以前就知道,只是没有认真的发现. 过程 前几天在开发页面的时候,有个需 ...

  5. React-Native 开发(二) 在react-native 中 运用 redux

    前提: 一个小web前端,完全不会android 跟iOS 的开发,首次接触,有很多不懂的问题.请见谅. 环境: win7 上一篇 : React-Native 开发(一) Android环境部署,H ...

  6. JavaScript中的ASCII碼轉換成字符的兩種方法

    方法一:轉義字符 \xxx:用十六進制的ASCII碼值轉換成字符. 方法二:String方法 String.fromCharCode(value): //用十進制的ASCII碼值轉換成字符. 舉例:結 ...

  7. iOS连续dismiss几个ViewController的方法

    原文链接:http://blog.csdn.net/longshihua/article/details/51282388 presentViewController是经常会用到的展现ViewCont ...

  8. python --- 插入排序算法

    先上一张图,看看能不能从里面悟出些什么: 问题的解决思路: 就是当插入第i个的时候,前面的[i- 1]个已经排好了,这时候lst[i]就倒过来逐个和前面的关键字顺序进行比较,找到插入位置即将lst[i ...

  9. js中Attribute和property的区别与联系

    相信大多数的初学者对js中的property和attribute的关系很容易搞混, Attribute大多用于DOM的操作中,比如ele.attributes指的是一个元素的特性集合,是一个nodel ...

  10. AtCoder Grand Contest 011

    AtCoder Grand Contest 011 upd:这篇咕了好久,前面几题是三周以前写的... AtCoder Grand Contest 011 A - Airport Bus 翻译 有\( ...