How to remove unicode from string?

前端 未结 4 1047
囚心锁ツ
囚心锁ツ 2020-11-27 23:27

I have a string like:

q <-\"  1000-66329\"

I want to remove and get only 1000 66329

4条回答
  •  孤街浪徒
    2020-11-28 00:14

    Instead of removing you should convert it to the appropriate format ... You have to set your local to UTF-8 like so:

    Sys.setlocale("LC_CTYPE", "en_US.UTF-8")
    

    Maybe you will see the following message:

    Warning message:
    In Sys.setlocale("LC_CTYPE", "en_US.UTF-8") :
      OS reports request to set locale to "en_US.UTF-8" cannot be honored
    

    In this case you should use stringi::stri_trans_general(x, "zh")

    Here "zh" means "chinese". You should know which language you have to convert to. That's it

提交回复
热议问题