split()
trim()
indexOf()
replaceAll()

##ruby:
String.split
"hello world".split( " ")
returns [ "hello", "world" ].


String.strip
" hello world ".strip
returns "hello world".

String.index
"hello world".index( "w")
returns 6.

String.gsub(/\s/, ',')
"hello word".gsub(\/s\, ',')
returns "hello,word"

p.s.
sub() replace first
gsub() replace all
评论
发表评论

您还没有登录,请登录后发表评论

eachlive
搜索本博客
博客分类
我的相册
最近加入圈子
最新评论
评论排行榜