网页设计 js字串处理

indexOf

"APPLE&LEMON".indexOf("APPLE") = 0 

-1 没有在里面


substr

substr(开始位置,截取长度)


replace

“helloworld”.replace(“world”,”apple”) = “helloapple”


toUpperCase

”“.toUpperCase 全大写


toLowerCase

首字母大写其他小写


split

“apple/banana”.split(“/”) = [“apple”,”banana”]


join

[“apple”,”lemon”].join(“+”) = “apple+lemon”