Package 'arabic2kansuji'

Title: Convert Arabic Numerals to Kansuji
Description: Simple functions to convert given Arabic numerals to Kansuji numerical figures that represent numbers written in Chinese characters.
Authors: Mao Kobayashi [aut, cre]
Maintainer: Mao Kobayashi <[email protected]>
License: MIT + file LICENSE
Version: 0.1.3.9000
Built: 2024-11-16 09:15:39 UTC
Source: https://github.com/indenkun/arabic2kansuji

Help Index


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.")