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

2016-11-13  本文已影响0人  lupinwu
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
上一篇 下一篇

猜你喜欢

热点阅读