How can you strip non-ASCII characters from a string? (in C#)

前端 未结 11 1361
迷失自我
迷失自我 2020-11-22 17:24

How can you strip non-ASCII characters from a string? (in C#)

11条回答
  •  耶瑟儿~
    2020-11-22 17:53

    no need for regex. just use encoding...

    sOutput = System.Text.Encoding.ASCII.GetString(System.Text.Encoding.ASCII.GetBytes(sInput));
    

提交回复
热议问题