C#中如何在字符串中设置上标
一、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.
你也可以直接复制里面的字符在程序中修改。
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | |
| U+00Bx | x² | x³ | x¹ | |||||||||||||
| 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ₜ |
| 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#中如何在字符串中设置上标的更多相关文章
- 在sqlserver中如何从字符串中提取数字,英文,中文,过滤重复字符
原文:在sqlserver中如何从字符串中提取数字,英文,中文,过滤重复字符 最近做项目的时候,经常用到一个字符串中的某些字符,处理起来非常的棘手,现在用下面的方法就可以很方便的从字符串中处理你想要的 ...
- Android中如何截取字符串中某个字符之前或之后的字符串
代码改变世界 Android中如何截取字符串中某个字符之前或之后的字符串 //截取#之前的字符串 String str = "sdfs#d"; str.substring(0, s ...
- asp.net中C#获取字符串中汉字的个数实例
符串可以包括数字,字母,汉字或者其他的字符.使用Char类型的IsDigit静态方法可以判断字符串中的字符是否为数字,使用Char类型中的 IsLetter静态方法可以判断字符串中是否为字母.我们来实 ...
- 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) ...
- java中如何忽略字符串中的转义字符--转载
原文地址:http://my.oschina.net/u/1010578/blog/366252 起因 这几天工作上需要跟另一个同事联调rest接口,我这边是java他是php,返回报文是js ...
- Excel中如何截取字符串中指定字符后的部分字符
1.如何给某列属性为时间整体加一个时间值: 场景一:假如我有一个excel中的某一列如下图所示,如何将该列的时间(用B代替整列)整体加一分钟呢?方法很简单,在空白单元格填写时间格式图中A所示 ...
- 20. orcle中统计一个字符串中某个字符的长度
例子1:统计一个字符串中“,”的个数: select lengthb(regexp_replace('[a,b,c,d,e,f]','[^,]',null)) as res from dual; 例 ...
- JSON中如何转义字符串中的双引号(转载)
问: I'm trying to show double quotes but it shows one of the backslashes: "maingame": { &qu ...
- 【HTML】处理<br>换行符追加到前端换行无效的问题 --- html中渲染的字符串中包含HTML标签无效的处理方法,字符串中包含HTML标签被转义的问题 解决
需求如下图: 追加给前台后,效果如下: 可以在源码看到: 是将后台给出来的数据,直接当作字符串给填充在了前台HTML中. 而查看浏览器编译后的HTML源码可以发现: 原来字符串中的<br> ...
随机推荐
- Android中设定EditText的输入长度(转)
如何限定Android的Text中的输入长度呢? 方法一:可以在layout xml中加上属性android:maxLength 比如: <EditText android:id ...
- 【SSM】拦截器的原理、实现
一.背景: 走过了双11,我们又迎来了黑色星期五,刚过了黑五,双12又将到来.不管剁手的没有剁手的,估计这次都要剁手了!虽然作为程序猿的我,没有钱但是我们长眼睛了,我们关注到的是我们天猫.淘宝.支付宝 ...
- Liferay 6.2 改造系列之十八:修改登录Portlet配置,去除无用链接
在/portal-master/portal-impl/src/portal.properties文件中,有如下配置: # # Input a list of sections that will b ...
- C# 静态方法和非静态方法
转载:http://www.cnblogs.com/mikelij/archive/2010/08/13/1798578.html 本文将围绕c#静态方法和实例方法讨论一下.针对一些观点,如:&quo ...
- 分享Kali Linux 2016.2第45周VMware虚拟机
分享Kali Linux 2016.2第45周VMware虚拟机本虚拟机使用Kali Linux 2016.2第45周镜像安装而成.有兴趣的同学,可以下载使用.(1)该虚拟机支持VMware 9.10 ...
- spring优化使用
1.bean由框架填充,避免手写优化代码. 2.view的展示通过配置或注解实现最优化使用架构. 待续...
- Fzu2109 Mountain Number 数位dp
Accept: 189 Submit: 461Time Limit: 1000 mSec Memory Limit : 32768 KB Problem Description One ...
- [bzoj1071]组队[单调指针乱搞]
这道题也很感人,主要改了比较久的时间... bzoj第一页的题,居然只过了五百多个人,(我是第512,orzliyicheng是513) 代码不长,但是细节搞了很久,主要sort写错了,晕... 首先 ...
- Tomcat 配置 Context
在 conf/Catalina/localhost/ 下添加 xml配置文件,文件名和站点名一致. 配置文件示例 <?xml version='1.0' encoding='utf-8'?> ...
- MFC HTTP访问URL
unsigned short nPort; //用于保存目标HTTP服务端口 CString strServer, strObject; //strServer用于保存服务器地址,strObject用 ...