How can I get special characters using elm-html module?

后端 未结 5 1234
伪装坚强ぢ
伪装坚强ぢ 2021-02-02 12:58

Disclaimer: I\'m brand new to Elm

I\'m fiddling around with the online Elm editor and I\'ve run into an issue. I can\'t find a way to get certain special charac

5条回答
  •  囚心锁ツ
    2021-02-02 13:57

    You can use directly the unicode escape code in Elm strings and chars:

    We have a util module containing all our special chars like:

    module Utils.SpecialChars exposing (noBreakSpace)
    
    noBreakSpace : Char
    noBreakSpace = '\x00A0'
    

    Which can be used as:

    let
      emptyLabel = String.fromChar noBreakSpace
    in
    label []
        [ span [ ] [ text emptyLabel ]
        ]
    

    This will render a  

提交回复
热议问题