NSString representation of fractions using unicode

前端 未结 4 1684
傲寒
傲寒 2021-01-12 15:42

I am trying to \"nicely\" display fractions in my iPhone application. Previously I have been using a tedious switch statement leading to hardcoded unicode characters for the

4条回答
  •  情深已故
    2021-01-12 16:20

    I know this was a long time ago, but if it helps, there are superscript Unicode characters for all decimal numbers you can use to display arbitrary fractions in most fonts; see answers on a similar question here - https://stackoverflow.com/a/30860163/4522315

    Edit:

    As per comments, this solution depends on the font you're using. Amsi Pro (left) and other commercial fonts tend to include all the required symbols for superscripts, but the system font (right) does not.

    Nice font System font

提交回复
热议问题