1234567891011121314151617181920 |
- /**
- * Created by CSL on 2017-06-06.
- * public functions for web.
- */
- // 忽略大小写判断字符串是否和参数指定的字符串相同
- String.prototype.sameText = function (str) {
- return this.toLowerCase() == str.toLowerCase();
- };
- // 忽略大小写判断字符串是否有参数指定的子串
- String.prototype.hasSubStr = function (str) {
- return this.toLowerCase().indexOf(str.toLowerCase()) > -1;
- };
- // 树结点计算时,取费会出现值为NaN的情况,导致往父节点汇总(递归相加)会出现错误。
- function parseFloatPlus(value){
- let rst = parseFloat(value);
- return isNaN(rst) ? 0 : rst;
- };
|