String.js /* total: 7 [ length, name, prototype, fromCharCode, fromCodePoint, raw, format ]*/Object.getOwnPropertyNames(String);/* total: 45 [ constructor, toString, valueOf, 返回字符串本身,console.log('x=' + x) +一边为数字时优
/* total: 7 [ length, name, prototype, fromCharCode, fromCodePoint, raw, format ] */ Object.getOwnPropertyNames(String); /* total: 45 [ constructor, toString, valueOf, 返回字符串本身,console.log('x=' + x) +一边为数字时优先调用valueOf方法,调用join()方法优先调用toString length, charAt, charCodeAt, concat, 返回新string,使用+连接速度更快 includes(subString, position), ES6 indexOf(searchValue[, fromIndex=0]), lastIndexOf(searchValue[, fromIndex=0]), 严格区分大小写 localeCompare(targetStr[, locales[, options]]), 0表示相等,目标string在原string前返回负数, normalize, replace(regexp|substr, newSubStr|function[, flags]), flags在V8内核中不起作用,不改变原字符串本身 slice(start, end), 返回start到end(不包括end)的新字符串 split(separator, limit), split()返回原始string数组、split('')返回原始string逐个分割的数组,limit截取前多少位 substr(start[, length]), start为负值则是length+start substring(indexA[, indexB]), 截取不包含indexB, indexA等于indexB返回'',若参数小于0或NaN则被当做0,若参数大于length就被当length,如果indexA>indexB,subString(A, B) === subString(B, A) startsWith(subString, position), ES6 判断是否是以给定字符串开始 tru|false endsWith, trim', 'trimLeft', 'trimRight', 去除空格 match(regexp), 隐式调用new RegExp, 带g参数返回纯数组或null,同RegExp.test(str), 不带g返回[str, index: num, input: originString]或null,同RegExp.exec(str) search(regexp), 比match更快,不支持g参数 repeat(num), ES6 只接受>=0整数或小数(自动向下转整),返回重复后的新string codePointAt(position), ES6 返回使用UTF-16编码的给定位置的非负整数 padStart padEnd, toLowerCase', 'toUpperCase', toLocaleLowerCase, toLocalrUpperCase, HTML相关方法 anchor, 创建锚点 link, "会自动转移为&\quot big, blink, bold', fixed, fontColor, fontSize, italics, samll, strike, sub, sup 均已废除 ] */ Object.getOwnPropertyNames(String.prototype);