xe-utils
Version:
JavaScript 函数库、工具类
15 lines (13 loc) • 409 B
JavaScript
import toValueString from './toValueString.js';import helperStringReplace from './helperStringReplace.js';/**
* 去除字符串左边的空格
*
* @param {String} str 字符串
* @return {String}
*/
function trimLeft (str) {
if (str && str.trimLeft) {
return str.trimLeft()
}
return helperStringReplace(toValueString(str), /^[\s\uFEFF\xA0]+/g, '')
}
export default trimLeft