- プロンプト実行例
スクリプトを複数ファイルにまとめます。
html
1<!DOCTYPE html>
2<html lang="ja">
3<head>
4 <meta charset="UTF-8">
5 <title>文字数カウントツール</title>
6<script>
7function countCharacters() {
8 var inputText = document.getElementById("input").value;
9
10 var charCount = inputText.length;
11 var charCountNoSpace = inputText.replace(/\s/g, '').length;
12 var wordCount = inputText.trim().split(/\s+/).length;
13 var lineBreakCount = (inputText.match(/\n/g) || []).length;
14 var alphabetCount = inputText.replace(/[^A-Za-z]/g, '').length;
15 var numberCount = inputText.replace(/[^0-9]/g, '').length;
16 var hiraganaCount = inputText.replace(/[^ぁ-んァ-ン]/g, '').length;
17 var katakanaCount = inputText.replace(/[^ァ-ン]/g, '').length;
18 var punctuationCount = inputText.replace(/[^。、.,\-]/g, '').length;
19 var symbolCount = inputText.replace(/[^!-~]/g, '').length;
20 var kanjiCount = inputText.replace(/[^一-龠々]/g, '').length;
21 var urlCount = inputText.split('http').length - 1;
22 var utf8ByteCount = new Blob([inputText], {type: 'plain/text'}).size;
23 var shiftJISByteCount = unescape(encodeURIComponent(inputText)).length;
24 var jisByteCount = inputText.replace(/[^ -~。-゚]/g, '').length;
25 var eucJPByteCount = encodeURIComponent(inputText).replace(/%[A-F\d]{2}/g, 'U').length;
26
27 var charPerPage = parseFloat(document.getElementById("charPerPage").value);
28 var includeHalfWidth = document.getElementById("includeHalfWidth").checked;
29
30 var pageCount = Math.ceil(charCount / charPerPage);
31 if (includeHalfWidth) {
32 charCount += inputText.replace(/[^\x01-\x7E]/g, '').length * -0.5;
33 }
34
35 document.getElementById("charCount").textContent = charCount;
36 document.getElementById("charCountNoSpace").textContent = charCountNoSpace;
37 document.getElementById("wordCount").textContent = wordCount;
38 document.getElementById("lineBreakCount").textContent = lineBreakCount;
39 document.getElementById("alphabetCount").textContent = alphabetCount;
40 document.getElementById("numberCount").textContent = numberCount;
41 document.getElementById("hiraganaCount").textContent = hiraganaCount;
42 document.getElementById("katakanaCount").textContent = katakanaCount;
43 document.getElementById("punctuationCount").textContent = punctuationCount;
44 document.getElementById("symbolCount").textContent = symbolCount;
45 document.getElementById("kanjiCount").textContent = kanjiCount;
46 document.getElementById("urlCount").textContent = urlCount;
47 document.getElementById("utf8ByteCount").textContent = utf8ByteCount;
48 document.getElementById("shiftJISByteCount").textContent = shiftJISByteCount;
49 document.getElementById("jisByteCount").textContent = jisByteCount;
50 document.getElementById("eucJPByteCount").textContent = eucJPByteCount;
51 document.getElementById("pageCount").textContent = pageCount;
52}
53</script>
54</head>
55<body>
56 <textarea id="input" rows="10" cols="50" placeholder="ここにテキストを入力してください"></textarea>
57 <br>
58 <button onclick="countCharacters()">文字数をカウント</button>
59 <br>
60 <label for="charPerPage">1ページあたりの文字数: </label>
61 <input type="number" id="charPerPage" value="400">
62 <label><input type="checkbox" id="includeHalfWidth">半角文字を0.5文字としてカウントする</label>
63 <br>
64 <p>文字数(スペース込み): <span id="charCount"></span></p>
65 <p>文字数(スペース無視): <span id="charCountNoSpace"></span></p>
66 <p>単語数: <span id="wordCount"></span></p>
67 <p>改行コード数: <span id="lineBreakCount"></span></p>
68 <p>英字数: <span id="alphabetCount"></span></p>
69 <p>数字数: <span id="numberCount"></span></p>
70 <p>ひらがな数: <span id="hiraganaCount"></span></p>
71 <p>カタカナ数: <span id="katakanaCount"></span></p>
72 <p>句読点数: <span id="punctuationCount"></span></p>
73 <p>記号数: <span id="symbolCount"></span></p>
74 <p>漢字数: <span id="kanjiCount"></span></p>
75 <p>URL数: <span id="urlCount"></span></p>
76 <p>UTF-8バイト数: <span id="utf8ByteCount"></span></p>
77 <p>Shift_JISバイト数: <span id="shiftJISByteCount"></span></p>
78 <p>JISバイト数: <span id="jisByteCount"></span></p>
79 <p>EUC_JPバイト数: <span id="eucJPByteCount"></span></p>
80 <p>原稿用紙何枚: <span id="pageCount"></span></p>
81</body>
82</html>html
1<!-- index.html -->
2<!DOCTYPE html>
3<html lang="ja">
4<head>
5 <meta charset="UTF-8">
6 <title>文字数カウントツール</title>
7 <link rel="stylesheet" type="text/css" href="styles.css">
8</head>
9<body>
10 <textarea id="input" rows="10" cols="50" placeholder="ここにテキストを入力してください"></textarea>
11 <br>
12 <button onclick="countCharacters()">文字数をカウント</button>
13 <br>
14 <label for="charPerPage">1ページあたりの文字数: </label>
15 <input type="number" id="charPerPage" value="400">
16 <label><input type="checkbox" id="includeHalfWidth">半角文字を0.5文字としてカウントする</label>
17 <br>
18 <p>文字数(スペース込み): <span id="charCount"></span></p>
19 <p>文字数(スペース無視): <span id="charCountNoSpace"></span></p>
20 <p>単語数: <span id="wordCount"></span></p>
21 <p>改行コード数: <span id="lineBreakCount"></span></p>
22 <p>英字数: <span id="alphabetCount"></span></p>
23 <p>数字数: <span id="numberCount"></span></p>
24 <p>ひらがな数: <span id="hiraganaCount"></span></p>
25 <p>カタカナ数: <span id="katakanaCount"></span></p>
26 <p>句読点数: <span id="punctuationCount"></span></p>
27 <p>記号数: <span id="symbolCount"></span></p>
28 <p>漢字数: <span id="kanjiCount"></span></p>
29 <p>URL数: <span id="urlCount"></span></p>
30 <p>UTF-8バイト数: <span id="utf8ByteCount"></span></p>
31 <p>Shift_JISバイト数: <span id="shiftJISByteCount"></span></p>
32 <p>JISバイト数: <span id="jisByteCount"></span></p>
33 <p>EUC_JPバイト数: <span id="eucJPByteCount"></span></p>
34 <p>原稿用紙何枚: <span id="pageCount"></span></p>
35 <script src="scripts.js"></script>
36</body>
37</html>css
1/* styles.css */
2/* Add your styles here */JavaScript
1// scripts.js
2function countCharacters() {
3 var inputText = document.getElementById("input").value;
4
5 var charCount = inputText.length;
6 var charCountNoSpace = inputText.replace(/\s/g, '').length;
7 var wordCount = inputText.trim().split(/\s+/).length;
8 var lineBreakCount = (inputText.match(/\n/g) || []).length;
9 var alphabetCount = inputText.replace(/[^A-Za-z]/g, '').length;
10 var numberCount = inputText.replace(/[^0-9]/g, '').length;
11 var hiraganaCount = inputText.replace(/[^ぁ-んァ-ン]/g, '').length;
12 var katakanaCount = inputText.replace(/[^ァ-ン]/g, '').length;
13 var punctuationCount = inputText.replace(/[^。、.,\-]/g, '').length;
14 var symbolCount = inputText.replace(/[^!-~]/g, '').length;
15 var kanjiCount = inputText.replace(/[^一-龠々]/g, '').length;
16 var urlCount = inputText.split('http').length - 1;
17 var utf8ByteCount = new Blob([inputText], {type: 'plain/text'}).size;
18 var shiftJISByteCount = unescape(encodeURIComponent(inputText)).length;
19 var jisByteCount = inputText.replace(/[^ -~。-゚]/g, '').length;
20 var eucJPByteCount = encodeURIComponent(inputText).replace(/%[A-F\d]{2}/g, 'U').length;
21
22 var charPerPage = parseFloat(document.getElementById("charPerPage").value);
23 var includeHalfWidth = document.getElementById("includeHalfWidth").checked;
24
25 var pageCount = Math.ceil(charCount / charPerPage);
26 if (includeHalfWidth) {
27 charCount += inputText.replace(/[^\x01-\x7E]/g, '').length * -0.5;
28 }
29
30 document.getElementById("charCount").textContent = charCount;
31 document.getElementById("charCountNoSpace").textContent = charCountNoSpace;
32 document.getElementById("wordCount").textContent = wordCount;
33 document.getElementById("lineBreakCount").textContent = lineBreakCount;
34 document.getElementById("alphabetCount").textContent = alphabetCount;
35 document.getElementById("numberCount").textContent = numberCount;
36 document.getElementById("hiraganaCount").textContent = hiraganaCount;
37 document.getElementById("katakanaCount").textContent = katakanaCount;
38 document.getElementById("punctuationCount").textContent = punctuationCount;
39 document.getElementById("symbolCount").textContent = symbolCount;
40 document.getElementById("kanjiCount").textContent = kanjiCount;
41 document.getElementById("urlCount").textContent = urlCount;
42 document.getElementById("utf8ByteCount").textContent = utf8ByteCount;
43 document.getElementById("shiftJISByteCount").textContent = shiftJISByteCount;
44 document.getElementById("jisByteCount").textContent = jisByteCount;
45 document.getElementById("eucJPByteCount").textContent = eucJPByteCount;
46 document.getElementById("pageCount").textContent = pageCount;
47}コメント 0
他のプロンプトもチェック
GPTs
音楽
私の役割は、Instagram、TikTok、YouTube、SoundCloud、Spotify、Apple Musicなどのプラットフォームからのオーディオクリップ、特に曲を特定することです。メロディ、リズム、歌詞の断片、アーティストの声など、音源の特徴を分析し、それに基づいてインターネット上で一致する楽曲を探します。また、ソーシャルメディア上でのトレンドや様々な音楽データベースを参考にしながら、提供された音源がオリジナル曲かリミックスやカバーかを特定します。曲についての追加情報、例えばアーティストやアルバムに関する情報も提供し、音楽探索の体験をサポートします。101.52K2.96K物語・脚本・プロット
推奨モデル - ChatGPTプロのラッパー2人がラップバトルをします!!毎回人物やラップは即興生成!0010121マーケティング一般
顧客の深層ニーズや課題を把握し、商品やサービスの価値提案を明確にします。 「自社のターゲットとなりうる顧客」と「その顧客が抱えている課題」をキーワードで入力すると、顧客のライフスタイル、消費行動、目標、動機、パーソナリティを包括的に分析し、ユーザーペイン、そしてペインリリーバーとなるセールスワードを生成、今後のマーケティング戦略を提言してくれます。2104471.66K