【问题标题】:How to show exponents under String.Format?如何在 String.Format 下显示指数?
【发布时间】:2018-08-11 20:11:25
【问题描述】:

如何在 string.format 中显示 a 的 2 次方?

analysis = String.Format("\nFormula: a^2 + b^2 = c^2");

我想以与 HTML 页面上相同的方式显示,而不是 a^2。

<strong>Formula: a<sup>2</sup> + b<sup>2</sup> = c<sup>2</sup></strong> 

【问题讨论】:

标签: c# html asp.net


【解决方案1】:

String.Format 不支持将字符转换为上标。您需要自己找到正确的字符并将 那些 传递给 String.Format。

See this answer for ways to do that.

【讨论】:

  • 知道了。谢谢你的帮助。这里是代码分析 = String.Format("Formula: a" + "\xB2" + "+ b" + "\xB2" + " = c" + "\xB2");
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-08-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-02-09
相关资源
最近更新 更多