{"size": 651, "ext": "js", "max_stars_repo_path": "src/string/insert.js", "max_stars_repo_name": "jxmyh99/wlUtils", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/string/insert.js", "max_issues_repo_name": "jxmyh99/wlUtils", "max_issues_repo_issues_event_min_datetime": "2020-09-06T21:20:30.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-02T05:11:09.000Z", "max_forks_repo_path": "src/string/insert.js", "max_forks_repo_name": "jxmyh99/wlUtils", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 7, "max_forks_count": null, "avg_line_length": 24.1111111111, "max_line_length": 65, "alphanum_fraction": 0.6466973886}
/*
 * @Author: 明月寒
 * @Github: http://www.33u3.com
 * @Date: 2019-08-13 11:14:34
 * @LastEditors: 明月寒
 * @LastEditTime: 2019-08-13 11:36:58
 * @Description: 
 */


/**
 * @description: 在特定位置插入特定字符
 * @param {str} 原字符 string
 * @param {insertStr} 拼接的字符 string
 * @param {insertIndex} 需要插入的特定位置 number
 * @return: 
 */
function insert(str, insertStr, insertIndex){
    var newStr = '';
    if(insertIndex >= str.length) return newStr= newStr+insertStr
    var before = str.substring(0, insertIndex),
        after = str.substring(insertIndex, str.length);
    newStr = before + "" + insertStr + "" + after;
    return newStr;
}

module.exports = insert;