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
- func JapaneseFinancialFloat(in float64, ones, prec int) string
- func JapaneseFinancialInt(in int64, ones int) string
- func JapaneseFinancialUint(in uint64, ones int) string
- func JapaneseFloat(in float64, ones, prec int) string
- func JapaneseInt(in int64, ones int) string
- func JapaneseOldFinancialFloat(in float64, ones, prec int) string
- func JapaneseOldFinancialInt(in int64, ones int) string
- func JapaneseOldFinancialUint(in uint64, ones int) string
- func JapaneseUint(in uint64, ones int) string
- func SimplifiedChineseFinancialFloat(in float64, prec int) string
- func SimplifiedChineseFinancialInt(in int64) string
- func SimplifiedChineseFinancialUint(in uint64) string
- func SimplifiedChineseFloat(in float64, prec int) string
- func SimplifiedChineseInt(in int64) string
- func SimplifiedChineseUint(in uint64) string
- func ToCantoneseVariant(in string) string
- func ToHongKongStandard(in string) string
- func ToJapaneseLaw(in string) string
- func TraditionalChineseFinancialFloat(in float64, prec int) string
- func TraditionalChineseFinancialInt(in int64) string
- func TraditionalChineseFinancialUint(in uint64) string
- func TraditionalChineseFloat(in float64, prec int) string
- func TraditionalChineseInt(in int64) string
- func TraditionalChineseUint(in uint64) string
Constants ¶
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 ¶
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 ¶
JapaneseFinancialInt returns kansuji of a `int64` in Japanese financial style. `ones` is one of `NoOnes`, `CommonOnes` and `AllOnes`.
func JapaneseFinancialUint ¶
JapaneseFinancialUint returns kansuji of a `uint64` in Japanese financial style. `ones` is one of `NoOnes`, `CommonOnes` and `AllOnes`.
func JapaneseFloat ¶
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 ¶
JapaneseInt returns kansuji of a `int64` in Japanese style. `ones` is one of `NoOnes`, `CommonOnes` and `AllOnes`.
func JapaneseOldFinancialFloat ¶
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 ¶
JapaneseOldFinancialInt returns kansuji of a `int64` in Japanese old style. `ones` is one of `NoOnes`, `CommonOnes` and `AllOnes`.
func JapaneseOldFinancialUint ¶
JapaneseOldFinancialUint returns kansuji of a `uint64` in Japanese old style. `ones` is one of `NoOnes`, `CommonOnes` and `AllOnes`.
func JapaneseUint ¶
JapaneseUint returns kansuji of a `uint64` in Japanese style. `ones` is one of `NoOnes`, `CommonOnes` and `AllOnes`.
func SimplifiedChineseFinancialFloat ¶
SimplifiedChineseFinancialFloat returns kansuji of a `float64` in simplified Chinese financial style.
`prec` has the same meaning of `strconv.FormatFloat`.
func SimplifiedChineseFinancialInt ¶
SimplifiedChineseFinancialInt returns kansuji of a `int64` in simplified Chinese financial style.
func SimplifiedChineseFinancialUint ¶
SimplifiedChineseFinancialUint returns kansuji of a `uint64` in simplified Chinese financial style.
func SimplifiedChineseFloat ¶
SimplifiedChineseFloat returns kansuji of a `float64` in simplified Chinese style.
`prec` has the same meaning of `strconv.FormatFloat`.
func SimplifiedChineseInt ¶
SimplifiedChineseInt returns kansuji of a `int64` in simplified Chinese style.
func SimplifiedChineseUint ¶
SimplifiedChineseUint returns kansuji of a `uint64` in simplified Chinese style.
func ToCantoneseVariant ¶
ToCantoneseVariant converts to oral Cantonese form of twenty, thirty and forty.
func ToHongKongStandard ¶
ToHongKongStandard converts the financial number three into the common form found in Hong Kong.
func ToJapaneseLaw ¶
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 ¶
TraditionalChineseFinancialFloat returns kansuji of a `float64` in traditional Chinese financial style.
`prec` has the same meaning of `strconv.FormatFloat`.
func TraditionalChineseFinancialInt ¶
TraditionalChineseFinancialInt returns kansuji of a `int64` in traditional Chinese financial style.
func TraditionalChineseFinancialUint ¶
TraditionalChineseFinancialUint returns kansuji of a `uint64` in traditional Chinese financial style.
func TraditionalChineseFloat ¶
TraditionalChineseFloat returns kansuji of a `float64` in traditional Chinese style.
`prec` has the same meaning of `strconv.FormatFloat`.
func TraditionalChineseInt ¶
TraditionalChineseInt returns kansuji of a `int64` in traditional Chinese style.
func TraditionalChineseUint ¶
TraditionalChineseUint returns kansuji of a `uint64` in traditional Chinese style.
Types ¶
This section is empty.