【问题标题】:Convert String to a Font Icon type UWP将字符串转换为字体图标类型 UWP
【发布时间】:2020-01-29 09:14:55
【问题描述】:

我正在开发一个调用 API 的 UWP 应用程序。 API 根据内容从MDL2 Assets 返回一个Glyph 代码。例如

{
    "content": "Line",
    "glyph": "F7B4"
}

现在我知道要显示来自 c# 的字形,我们需要使用 \uF7B4,但这里的问题是 API 不能返回 \uF7B4 而不是 "F7B4"。有什么方法可以进行此转换

【问题讨论】:

  • (char)(Convert.ToInt32("F7B4", 16))?

标签: c# uwp char uwp-xaml


【解决方案1】:

你可以试试Converting如下:

 string glyph = "F7B4";

 char result = (char)(Convert.ToInt32(glyph, 16)); // '\uF7B4'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-10-29
    • 1970-01-01
    • 2021-03-30
    • 2017-03-05
    • 2020-05-21
    • 1970-01-01
    • 2010-09-20
    • 1970-01-01
    相关资源
    最近更新 更多