美文网首页
2023-07-28如何将大段英文提取出独立显示的单词?

2023-07-28如何将大段英文提取出独立显示的单词?

作者: Exap | 来源:发表于2023-07-27 23:06 被阅读0次

js 替換字符串中的字符https://www.w3school.com.cn/jsref/jsref_replace.asp主要替换换行

split()  字符串分割;

function sortArray(array) { array.sort((a, b) => a.length - b.length) return array }

console.log(sortArray(b))

const result = Array.from(new Set(sortArray(e)))

https://yuyp1996.github.io/yyp-demo/dist/#/adaptiveTextarea怎么做文本框

怎么获取文本框中的文字?

code:在F12控制台中使用


var myElements = document.getElementById("eleArea").innerHTML; //获取id为eleArea的dom的字符串


let OutPutWords = myElements.replace(/\n/gi," ").replace(/\t\t/g," ") //替换掉换行回车


OutPutWords.split(" ").sort((a, b) => a.length - b.length)

const uniqueArr = [...new Set(OutPutWords)]


function saveShareContent (content, fileName) {

    let downLink = document.createElement('a')

    downLink.download = fileName

    //字符内容转换为blod地址

    let blob = new Blob([content])

    downLink.href = URL.createObjectURL(blob)

    // 链接插入到页面

    document.body.appendChild(downLink)

    downLink.click()

    // 移除下载链接

    document.body.removeChild(downLink)

}


saveShareContent(uniqueArr,20230728)

相关文章

网友评论

      本文标题:2023-07-28如何将大段英文提取出独立显示的单词?

      本文链接:https://www.haomeiwen.com/subject/iwsrpdtx.html