foldKana関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Fold text for a Japanese search: width and compatibility forms (NFKC: half-width katakana becomes full-width), hiragana to katakana, and a small kana (ッ, ャ, ァ) to its full-size one. The long-vowel mark ー is left as it is, and so is everything that is not kana
(letter case is the caller's, as it is for any search). Put it on both sides of a comparison: foldKana("はっぶる") === foldKana("ハッブル"), and ハッブル is also ハツブル after it, so a reader who types a small kana as a full-size one still finds it.
インポート
import { foldKana } from "@johnmorrisdotca/chikyu-earth/satellites";
定義
function foldKana(text: string): string
引数
| 名前 | 型 | 説明 |
|---|---|---|
text | string | What was typed, or a name to compare it with. |
戻り値
string
The folded text.
例
import { foldKana } from "@johnmorrisdotca/chikyu-earth/satellites";
console.log(foldKana("はっぶる") === foldKana("ハッブル"));
console.log(foldKana("ほし ー"));true
ホシ ー出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。