用perl去掉Unicode换行字符
?“I have a string that is read from a text file but in Ubuntu Linux,and I try to delete its newline character from the end. I used all the ways. But for? 大体意思就是文本最后包含Unicode字符集中的换行符,但是使用chomp无法解决。 解决方案: ? ? ?1. use 5.010; ? ? ? ??The correct way to remove Unicode linebreak graphemes,including CRLF pairs,is using the? ? ? ? $data=~s/R//g; ? ? ? 2. 直接替换 ?$data=~s/[nr]+$//; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |