[Stable]

str_jconv(str, fun, to)

str_conv_hirakana(str, to = c("hiragana", "katakana"))

str_conv_zenhan(str, to = c("zenkaku", "hankaku"))

str_conv_romanhira(str, to = c("roman", "hiragana"))

str_conv_normalize(str, to = c("nfkc"))

Arguments

str

Input vector.

fun

convert function

to

Select the type of character to convert.

Details

Converts the types of string treat by Japanese people to each other. The following types are supported.

  • Hiraganra to Katakana

  • Zenkaku to Hankaku

  • Latin (Roman) to Hiragana

See also

These functions are powered by the stringi package's stri_trans_general().

Examples

str_jconv("\u30a2\u30a4\u30a6\u30a8\u30aa", str_conv_hirakana, to = "hiragana")
#> [1] "あいうえお"
str_jconv("\u3042\u3044\u3046\u3048\u304a", str_conv_hirakana, to = "katakana")
#> [1] "アイウエオ"
str_jconv("\uff41\uff10", str_conv_zenhan, "hankaku")
#> [1] "a0"
str_jconv("\uff76\uff9e\uff6f", str_conv_zenhan, "zenkaku")
#> [1] "ガッ"
str_jconv("\u30a2\u30a4\u30a6\u30a8\u30aa", str_conv_romanhira, "roman")
#> [1] "aiueo"
str_jconv("\u2460", str_conv_normalize, "nfkc")
#> [1] "1"
str_conv_hirakana("\u30a2\u30a4\u30a6\u30a8\u30aa", to = "hiragana")
#> [1] "あいうえお"
str_conv_hirakana("\u3042\u3044\u3046\u3048\u304a", to = "katakana")
#> [1] "アイウエオ"
str_conv_zenhan("\uff41\uff10", "hankaku")
#> [1] "a0"
str_conv_zenhan("\uff76\uff9e\uff6f", "zenkaku")
#> [1] "ガッ"
str_conv_romanhira("aiueo", "hiragana")
#> [1] "あいうえお"
str_conv_romanhira("\u3042\u3044\u3046\u3048\u304a", "roman")
#> [1] "aiueo"
str_conv_normalize("\u2460", "nfkc")
#> [1] "1"