美文网首页
4-6 如何去掉字符串中不需要的字符

4-6 如何去掉字符串中不需要的字符

作者: lupinwu | 来源:发表于2016-11-13 16:54 被阅读0次
Paste_Image.png

方法1,只可以删除两端的字符,中间的不行

Paste_Image.png

方法2

Paste_Image.png

方法3

replace()方法一次只能删除一种字符串


Paste_Image.png

sub()方法可以一次删除多种字符串


Paste_Image.png

方法4

translate()方法原始目的:用于映射文本加密


Paste_Image.png

用于删除


Paste_Image.png

解决音调问题


Paste_Image.png

相关文章

网友评论

      本文标题:4-6 如何去掉字符串中不需要的字符

      本文链接:https://www.haomeiwen.com/subject/rrecpttx.html