字符串位置方法

mac2022-06-30  27

1  var stringValue = "Lorem ipsum dolor sit amet, consectetur adipisicing elit"; 2  var positions =  new Array(); 3  var pos = stringValue.indexOf("e"); 4  5  while (pos > -1) { 6     positions.push(pos); 7     pos = stringValue.indexOf("e", pos + 1); 8 } 9 console.log(positions);

转载于:https://www.cnblogs.com/qzsonline/archive/2012/03/14/2396102.html

最新回复(0)