我只需要过滤类别类型,而是我的代码返回定义的字符串。
我的预期输出是:家具沙发厨房。
var contextstr =
'Lorem Ipsum is category:funiture dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since category:sofa 1500s, when an unknown printer took a category:galley of type and scrambled it to make a type';
var count = 0;
while (true) {
var findpos = contextstr.indexOf('category:', count);
if (findpos == -1) break;
var startpos = findpos + 9;
var endpos = contextstr.indexOf(' ', startpos);
var printcat = contextstr.substring(startpos + endpos);
document.write(printcat + '<br>');
//x++;
count = endpos + 1;
}
精慕HU
偶然的你
元芳怎么了
相关分类