<commit_before>function setCharAt(str, index, chr) {
    if (index > str.length - 1) return str;
    return str.substr(0, index + 1) + chr + str.substr(index + 1);
}

$(document).ready(function () {
    // In details and add page: covert assignable questions table to the Datatable
    $('#rentals').DataTable();
    $('#rentals_history').DataTable();
    $('#usrs').DataTable();
    $('#devs').DataTable();


    var total_length = 0;
    $('#devices').bind('input propertychange', function (event) {
        var inputLength = event.target.value.length;

        if (inputLength > total_length && (inputLength % 5 === 0)) {
            var thisVal = event.target.value;
            var newValue = setCharAt(thisVal, thisVal.length - 2, '-');
            $(event.target).val(newValue);
            total_length = newValue.length;
        }

        total_length = inputLength;

        $('#charNum').text(event.target.value.split("-").length);
    })
});<commit_msg>js device number size 4 -> 5<commit_after>function setCharAt(str, index, chr) {
    if (index > str.length - 1) return str;
    return str.substr(0, index + 1) + chr + str.substr(index + 1);
}

$(document).ready(function () {
    // In details and add page: covert assignable questions table to the Datatable
    $('#rentals').DataTable();
    $('#rentals_history').DataTable();
    $('#usrs').DataTable();
    $('#devs').DataTable();


    var total_length = 0;
    $('#devices').bind('input propertychange', function (event) {
        var inputLength = event.target.value.length;

        if (inputLength > total_length && (inputLength % 6 === 0)) {
            var thisVal = event.target.value;
            var newValue = setCharAt(thisVal, thisVal.length - 2, '-');
            $(event.target).val(newValue);
            total_length = newValue.length;
        }

        total_length = inputLength;

        $('#charNum').text(event.target.value.split("-").length);
    })
});
{'fraction_non_alphanumeric': 0.1694915254237288, 'fraction_numerical': 0.009244992295839754, 'mean_word_length': 2.7751937984496124, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4537450', 'n_tokens_mistral': 593, 'n_tokens_neox': 578, 'n_words': 133}