字數統計工具



字數統計工具

字數統計工具

字數(漢字/單詞):0

字符數(包括空格):0

字符數(不包括空格):0

<script>
    const textInput = document.getElementById('text-input');
    const wordCount = document.getElementById('word-count');
    const charCountWithSpaces = document.getElementById('char-count-with-spaces');
    const charCountWithoutSpaces = document.getElementById('char-count-without-spaces');

    function updateStats() {
        const text = textInput.value;

        // 計算字數(考慮中文和英文)
        const wordRegex = /[\u4e00-\u9fa5]|[a-zA-Z]+/g;
        const words = text.match(wordRegex) || [];
        wordCount.textContent = words.length;

        // 計算字符數(包括空格)
        charCountWithSpaces.textContent = text.length;

        // 計算字符數(不包括空格)
        charCountWithoutSpaces.textContent = text.replace(/\s/g, '').length;
    }

    textInput.addEventListener('input', updateStats);
</script>
分享給你的朋友

美股表現近年持續強勁,不知如何入手?我們精選了10隻高增長美股,並撰寫了《不應錯過的10隻高增長美股》免費報告。立即按此下載!

想提早退休? 想提高每月的被動收入?

我們撰寫的《必須收藏的收息股投資指南》電子書用實例教您挑選出真正可長期持續派息的收息股及揭示必要避開的收息「陷阱」。要知道打造穩健收息投資組合的竅訣,請立即按此免費下載!

本文所提供的信息僅供一般參考之用,並不構成任何個人化的投資勸誘或建議。作者沒持有以上提及的股票。
HK MoneyClub (www.hkmoneyclub.com)