How do I remove all Unicode newlines from a UTF-8 string in GoLang? I found this answer for PHP.
1条回答 默认 最新
- dongtai6741 2016-07-11 14:28关注
You can use
strings.Map
:func filterNewLines(s string) string { return strings.Map(func(r rune) rune { switch r { case 0x000A, 0x000B, 0x000C, 0x000D, 0x0085, 0x2028, 0x2029: return -1 default: return r } }, s) }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报