kansuji

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2020 License: MIT Imports: 2 Imported by: 0

README

Package kansuji

Go Report Card GoDoc PkgGoDev

Package kansuji provides kansuji conversion.

The "kansuji" is the romanization form of japanese "漢数字", which has the same meaning of Chinese "中文數字" ("中文数字", means Chinese number). As a matter of fact, these numbers have been used originally by Chinese for thousands of years. The reason to use "kansuji" was just for simple and short.

In the age of Ming dynasty, the Hongwu Emperor (Chu Yuan-chang) has forced the domestic financial system to use the financial style numbers, which are Chinese characters with lots of strokes, that can hardly be modified, compared to the very simple characters originally stand for numbers. This package supports both forms of kansuji.

Reference

  1. 中文数字, https://zh.wikipedia.org/wiki/%E4%B8%AD%E6%96%87%E6%95%B0%E5%AD%97
  2. 漢数字, https://ja.wikipedia.org/wiki/%E6%BC%A2%E6%95%B0%E5%AD%97
  3. 中华人民共和国国家标准 GB/T 15835—2011 出版物上数字用法
  4. 大字 (数字), https://ja.wikipedia.org/wiki/%E5%A4%A7%E5%AD%97_(%E6%95%B0%E5%AD%97)
  5. 大正十一年大蔵省令第四十三号(会計法規ニ基ク出納計算ノ数字及記載事項ノ訂正ニ関スル件), https://elaws.e-gov.go.jp/search/elawsSearch/elaws_search/lsg0500/detail?lawId=211M10000040043

Status

This project is under developing, you may make any pull requests to add features or sending ideas by writing issues.

Documentation

Overview

Package kansuji provides kansuji conversion.

The "kansuji" is the romanization form of japanese "漢数字", which has the same meaning of Chinese "中文數字" ("中文数字", means Chinese number). As a matter of fact, these numbers have been used originally by Chinese for thousands of years. The reason to use "kansuji" was just for simple and short.

In the age of Ming dynasty, the Hongwu Emperor (Chu Yuan-chang) has forced the domestic financial system to use the financial style numbers, which are Chinese characters with lots of strokes, that can hardly be modified, compared to the very simple characters originally stand for numbers.

This package supports both forms of kansuji.

Index

Constants

View Source
const (
	NoOnes int = iota
	CommonOnes
	AllOnes
)

In Japanese, there are several styles of "ones". NoOnes means no "one"s before "ten"s, "hundred"s and "thousand"s. CommonOnes puts the optional "one" before every "thousand". AllOnes puts every "one" explicitly (usually used in financial situations).

Variables

This section is empty.

Functions

func JapaneseFinancialFloat

func JapaneseFinancialFloat(in float64, ones, prec int) string

JapaneseFinancialFloat returns kansuji of a `float64` in Japanese financial style. `ones` is one of `NoOnes`, `CommonOnes` and `AllOnes`.

`prec` has the same meaning of `strconv.FormatFloat`.

func JapaneseFinancialInt

func JapaneseFinancialInt(in int64, ones int) string

JapaneseFinancialInt returns kansuji of a `int64` in Japanese financial style. `ones` is one of `NoOnes`, `CommonOnes` and `AllOnes`.

func JapaneseFinancialUint

func JapaneseFinancialUint(in uint64, ones int) string

JapaneseFinancialUint returns kansuji of a `uint64` in Japanese financial style. `ones` is one of `NoOnes`, `CommonOnes` and `AllOnes`.

func JapaneseFloat

func JapaneseFloat(in float64, ones, prec int) string

JapaneseFloat returns kansuji of a `float64` in Japanese style. `ones` is one of `NoOnes`, `CommonOnes` and `AllOnes`.

`prec` has the same meaning of `strconv.FormatFloat`.

func JapaneseInt

func JapaneseInt(in int64, ones int) string

JapaneseInt returns kansuji of a `int64` in Japanese style. `ones` is one of `NoOnes`, `CommonOnes` and `AllOnes`.

func JapaneseOldFinancialFloat

func JapaneseOldFinancialFloat(in float64, ones, prec int) string

JapaneseOldFinancialFloat returns kansuji of a `float64` in Japanese old style. `ones` is one of `NoOnes`, `CommonOnes` and `AllOnes`.

`prec` has the same meaning of `strconv.FormatFloat`.

func JapaneseOldFinancialInt

func JapaneseOldFinancialInt(in int64, ones int) string

JapaneseOldFinancialInt returns kansuji of a `int64` in Japanese old style. `ones` is one of `NoOnes`, `CommonOnes` and `AllOnes`.

func JapaneseOldFinancialUint

func JapaneseOldFinancialUint(in uint64, ones int) string

JapaneseOldFinancialUint returns kansuji of a `uint64` in Japanese old style. `ones` is one of `NoOnes`, `CommonOnes` and `AllOnes`.

func JapaneseUint

func JapaneseUint(in uint64, ones int) string

JapaneseUint returns kansuji of a `uint64` in Japanese style. `ones` is one of `NoOnes`, `CommonOnes` and `AllOnes`.

func SimplifiedChineseFinancialFloat

func SimplifiedChineseFinancialFloat(in float64, prec int) string

SimplifiedChineseFinancialFloat returns kansuji of a `float64` in simplified Chinese financial style.

`prec` has the same meaning of `strconv.FormatFloat`.

func SimplifiedChineseFinancialInt

func SimplifiedChineseFinancialInt(in int64) string

SimplifiedChineseFinancialInt returns kansuji of a `int64` in simplified Chinese financial style.

func SimplifiedChineseFinancialUint

func SimplifiedChineseFinancialUint(in uint64) string

SimplifiedChineseFinancialUint returns kansuji of a `uint64` in simplified Chinese financial style.

func SimplifiedChineseFloat

func SimplifiedChineseFloat(in float64, prec int) string

SimplifiedChineseFloat returns kansuji of a `float64` in simplified Chinese style.

`prec` has the same meaning of `strconv.FormatFloat`.

func SimplifiedChineseInt

func SimplifiedChineseInt(in int64) string

SimplifiedChineseInt returns kansuji of a `int64` in simplified Chinese style.

func SimplifiedChineseUint

func SimplifiedChineseUint(in uint64) string

SimplifiedChineseUint returns kansuji of a `uint64` in simplified Chinese style.

func ToCantoneseVariant

func ToCantoneseVariant(in string) string

ToCantoneseVariant converts to oral Cantonese form of twenty, thirty and forty.

func ToHongKongStandard

func ToHongKongStandard(in string) string

ToHongKongStandard converts the financial number three into the common form found in Hong Kong.

func ToJapaneseLaw

func ToJapaneseLaw(in string) string

ToJapaneseLaw converts four financial numbers defined in Japanese laws.

See https://ja.wikipedia.org/wiki/%E5%A4%A7%E5%AD%97_(%E6%95%B0%E5%AD%97)

func TraditionalChineseFinancialFloat

func TraditionalChineseFinancialFloat(in float64, prec int) string

TraditionalChineseFinancialFloat returns kansuji of a `float64` in traditional Chinese financial style.

`prec` has the same meaning of `strconv.FormatFloat`.

func TraditionalChineseFinancialInt

func TraditionalChineseFinancialInt(in int64) string

TraditionalChineseFinancialInt returns kansuji of a `int64` in traditional Chinese financial style.

func TraditionalChineseFinancialUint

func TraditionalChineseFinancialUint(in uint64) string

TraditionalChineseFinancialUint returns kansuji of a `uint64` in traditional Chinese financial style.

func TraditionalChineseFloat

func TraditionalChineseFloat(in float64, prec int) string

TraditionalChineseFloat returns kansuji of a `float64` in traditional Chinese style.

`prec` has the same meaning of `strconv.FormatFloat`.

func TraditionalChineseInt

func TraditionalChineseInt(in int64) string

TraditionalChineseInt returns kansuji of a `int64` in traditional Chinese style.

func TraditionalChineseUint

func TraditionalChineseUint(in uint64) string

TraditionalChineseUint returns kansuji of a `uint64` in traditional Chinese style.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL