本文へ移動

Hikidashi引き出し

和暦と漢数字の相互変換、活用した語の辞書形、漢字への読みの割り当て、貼り付けた文からの単語の抽出、文の難しさ。日本語のテキストを扱う小さな道具を集めた引き出しです。

「引き出し」という名前は、道具が一つずつしまってあり、必要なときに取り出して使える、という意味です。 名前について(英語)

目次

リファレンス · 貼り付けた文

sanitizePastedText関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

The text as it will be read: control and invisible characters (and line and paragraph separators) turned into spaces, then cut to EXTRACT_LIMITS.characters.

インポート

import { sanitizePastedText } from "@johnmorrisdotca/hikidashi/extract";

ほかのエクスポート元: @johnmorrisdotca/hikidashi

定義

function sanitizePastedText(raw: string): { text: string; truncated: boolean; }

引数

名前型説明
rawstring

The pasted text, of any length.

戻り値

{ text: string; truncated: boolean; }

The cleaned text, and whether it was cut.

例

import { sanitizePastedText } from "@johnmorrisdotca/hikidashi/extract";

console.log(sanitizePastedText("水\u0000を\u200b飲む"));
{ text: '水 を 飲む', truncated: false }

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/hikidashi 1.1.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。