MCPcopy Index your code
hub / github.com/hoothin/UserScripts / str2Num

Function str2Num

DownloadAllContent/DownloadAllContent.user.js:520–537  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

518 }
519
520 function str2Num(str) {
521 str = str.replace(/^番\s*外/, "99999+").replace(/[一①Ⅰ壹]/g, "1").replace(/[二②Ⅱ贰]/g, "2").replace(/[三③Ⅲ叁]/g, "3").replace(/[四④Ⅳ肆]/g, "4").replace(/[五⑤Ⅴ伍]/g, "5").replace(/[六⑥Ⅵ陆]/g, "6").replace(/[七⑦Ⅶ柒]/g, "7").replace(/[八⑧Ⅷ捌]/g, "8").replace(/[九⑨Ⅸ玖]/g, "9").replace(/[十⑩Ⅹ拾]/g, "*10+").replace(/[百佰]/g, "*100+").replace(/[千仟]/g, "*1000+").replace(/[万萬]/g, "*10000+").replace(/\s/g, "").match(/[\d\*\+]+/);
522 if (!str) return 0;
523 str = str[0];
524 let mul = str.match(/(\d*)\*(\d+)/);
525 while(mul) {
526 let result = parseInt(mul[1] || 1) * parseInt(mul[2]);
527 str = str.replace(mul[0], result);
528 mul = str.match(/(\d+)\*(\d+)/);
529 }
530 let plus = str.match(/(\d+)\+(\d+)/);
531 while(plus) {
532 let result = parseInt(plus[1]) + parseInt(plus[2]);
533 str = str.replace(plus[0], result);
534 plus = str.match(/(\d+)\+(\d+)/);
535 }
536 return parseInt(str);
537 }
538
539 var dragOverItem, dragFrom, linkDict;
540 function createLinkItem(aEle) {

Callers 2

filterListFunction · 0.85
indexDownloadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected