Type: Package
Title: Convert Arabic Numerals to Kansuji
Version: 0.1.3
Description: Simple functions to convert given Arabic numerals to Kansuji numerical figures that represent numbers written in Chinese characters.
License: MIT + file LICENSE
URL: https://github.com/indenkun/arabic2kansuji
BugReports: https://github.com/indenkun/arabic2kansuji/issues
Encoding: UTF-8
RoxygenNote: 7.2.1
Imports: purrr, stringr, stats
Language: en-US
NeedsCompilation: no
Packaged: 2022-10-13 03:15:53 UTC; kobayashi
Author: Mao Kobayashi [aut, cre]
Maintainer: Mao Kobayashi <kobamao.jp@gmail.com>
Repository: CRAN
Date/Publication: 2022-10-13 03:42:34 UTC

Convert Arabic numerals to Kansuji

Description

Converts a given Arabic numerals to Kansuji numerical figures that written in Chinese characters (in other words, Chinese numeral). arabic2kansuji() function can also convert Arabic numerals in the string to kansuji. arabic2kansuji_num() function can convert a vector of only one Arabic numerals to Kansuji. Use arabic2kansuji_all() can calculate and convert Arabic numerals to Kansuji while retaining the original non-Arabic numeral string.

Usage

arabic2kansuji(str, zero = c("rei", "zero"), width = c("half", "full", "all"))

arabic2kansuji_num(
  num,
  add.one_thousand = TRUE,
  add.one_thousand.all = FALSE,
  ...
)

arabic2kansuji_all(
  str,
  widths = c("half", "all"),
  add.one_thousand = TRUE,
  add.one_thousand.all = FALSE,
  ...
)

Arguments

str

Input vector.

zero

Selects whether 0 should be zero like o ("rei") or zero like have rain crown ("zero") when Arabic numerals are converted to kansuji.

width

Selects whether you want to convert Arabic numbers, only half-width numbers ("half") or only full-width numbers ("full") or both half-width and full-width numbers ("all") when converting Arabic numbers to kansuji.

num

Input only number. Accept more than one number.

add.one_thousand

a logical whether or not 1 should be displayed as a Kansuji numeral when the thousandth digit is 1.

add.one_thousand.all

Specifies whether or not to display the Kansuji numeral 1 when the number is 1,000. This is valid only when add.one_thousand is TRUE.

...

Other arguments to carry over to 'arabic2kansuji()'.

widths

Selects whether you want to convert Arabic numbers, only half-width numbers ("half") or both half-width and full-width numbers ("all") when converting Arabic numbers to Kansuji.

Value

a character.

Examples

arabic2kansuji(2020)
arabic2kansuji(2020, zero = "zero")
arabic2kansuji(c(2019, 2020, 2021))
arabic2kansuji_num(2020)
arabic2kansuji_num((c(2019, 2020, 2021)))
arabic2kansuji_all("This year is 2020, next year is 2021.")