欢迎光临散文网 会员登陆 & 注册

Day3 | 取模强转

2021-09-04 10:18 作者:剑离我离  | 我要投稿

在JAVA中,为了防止相加的溢出,常对数进行取模(1e9+7),但在取模后需要强转为int,不然会报错。

如:


百度文库 使用控制台转化doc文档文字  

//1.获取文本

let topDiff = -1;

let content = "";

var filename= document.getElementsByClassName('doc-title')[0].innerText;


const target = document.querySelectorAll(".reader-word-layer"); 

target.forEach(x => {

    if (x.style.top !== topDiff) {

        content += "\n";

        topDiff = x.style.top;

    };

    content += x.innerText;

}); 


//2.创建下载链接,下载到本地

var element = document.createElement('a');

 element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(content));

 element.setAttribute('download', filename+".doc");

 

 element.style.display = ".reader-word-layer";

 document.body.appendChild(element);

 

 element.click();

 

 document.body.removeChild(element);


Day3 | 取模强转的评论 (共 条)

分享到微博请遵守国家法律