var santent='this is one santent. this is a santent with a list of items:'+'cherries,oranges,apples,bananas. that was the list of items.';  //创建一个字符串
var start = santent.indexOf(':');  //找到要提取列表开始位置
var end = santent.indexOf('.',start+1); //找到要提取列表的结束位置
var liststr=santent.substring(start+1,end);//通过substring提取中间的字符
var fruits=liststr.split(',');//split通过逗号分隔字符串成为数组

console.log(fruits);

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
  • 2022-12-23
  • 2021-12-22
  • 2021-12-22
相关资源
相似解决方案