通过indexOf()查找某个字符串位置

AS。的

// 循环直到indexOf()返回-1
while ( ( index = example.indexOf( "cool", index + 1 ) ) != -1 ) {
/* 显示:
String contains word cool at index 30
String contains word cool at index 41
String contains word cool at index 52
*/
trace( "String contains word cool at index " + index );

}

 兄弟伙推荐个团购导航

http://www.izhaotuan.com/

原文地址:https://www.cnblogs.com/melonlee/p/1323017.html