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

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

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

11条回答
  •  清歌不尽
    2020-11-22 17:40

    string s = "søme string";
    s = Regex.Replace(s, @"[^\u0000-\u007F]+", string.Empty);
    

提交回复
热议问题