# fun-tools **Repository Path**: bzm121/fun-tools ## Basic Information - **Project Name**: fun-tools - **Description**: 一套javascript的工具包 - **Primary Language**: JavaScript - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-06-26 - **Last Updated**: 2023-07-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: JavaScript, Nodejs ## README 它们按照功能分类介绍给您。 加载HTML - htmlAssign.loadHtml(url, callback):该方法用于异步加载HTML文件,其中 url 参数为HTML文件的路径,callback 参数为加载完成后的回调函数。 格式化日期时间 - formatDatetime.DateInit(dateStr):该方法用于将日期字符串转换为日期对象。 - formatDatetime.formatDate(date, fmt):该方法用于将日期对象格式化为指定格式的日期字符串。 字符串操作 - String.prototype.trim():该方法用于去除字符串首尾空格。 - String.prototype.ltrim():该方法用于去除字符串左侧空格。 - String.prototype.rtrim():该方法用于去除字符串右侧空格。 - String.prototype.startsWith(searchString[, position]):该方法用于判断字符串是否以指定的字符串开头。 - String.prototype.endsWith(searchString[, length]):该方法用于判断字符串是否以指定的字符串结尾。 - String.prototype.contains(searchString[, position]):该方法用于判断字符串是否包含指定的字符串。 - String.prototype.replaceAll(searchValue, replaceValue):该方法用于将字符串中所有匹配 searchValue 的子串替换为 replaceValue。 数组操作 - Array.prototype.indexOf(searchElement[, fromIndex]):该方法用于查找数组中指定元素的位置。 - Array.prototype.lastIndexOf(searchElement[, fromIndex]):该方法用于查找数组中指定元素最后出现的位置。 - Array.prototype.contains(searchElement):该方法用于判断数组是否包含指定元素。 - Array.prototype.removeByValue(value):该方法用于从数组中删除指定元素。 - Array.prototype.removeByIndex(index):该方法用于从数组中删除指定位置的元素。 HTML操作 - assign.html(id, html):该方法用于将指定ID的HTML元素的内容替换为指定的HTML代码。 - assign.val(id, value):该方法用于将指定ID的表单元素的值替换为指定的值。