How to use the nzh.cn function in nzh

To help you get started, we’ve selected a few nzh examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Ice-Hazymoon / MikuTools / pages / number_to_zh.vue View on Github external
isZhNum() {
            if (!this.hanzi.length) {
                this.$swal({
                    type: 'error',
                    title: '转换失败',
                    text: `ERROR: 你还没有输入`
                });
                return;
            }
            const regexlower = /^负?[零一二三四五六七八九十百千万亿]*点?[零一二三四五六七八九]*$/g;
            const regexupper = /^负?[零壹贰叁肆伍陆柒捌玖拾佰仟万亿]*点?[零壹贰叁肆伍陆柒捌玖]*$/g;
            if (regexlower.test(this.hanzi)) {
                this.numResult = Nzh.cn.decodeS(this.hanzi);
            } else if (regexupper.test(this.hanzi)) {
                this.numResult = Nzh.cn.decodeB(this.hanzi);
            } else {
                this.$swal({
                    type: 'error',
                    title: '转换失败',
                    text: `ERROR: 请输入正确的大小写中文数字`
                });
                return;
            }
        }
    }
github sishuguojixuefu / react-native-form / src / components / SsAmount.tsx View on Github external
import React, { Component } from 'react'
import { InputItem } from '@sishuguojixuefu/antd-mobile-rn'
import { View, Text, StyleSheet } from 'react-native'
import stringWidth from 'string-width'
import nzh from 'nzh'
import omit from 'lodash.omit'
import { SsAmountProps } from '../utils/PropTypes'
import getFieldDecorator from '../utils/getFieldDecorator'
import Label from './helper/Label'
import ErrorTip from './helper/ErrorTip'

const nzhCn = nzh.cn

export default class SsAmount extends Component {
  private fieldDecorator: any
  private chineseAmount = ''
  static defaultProps = {
    required: false,
    placeholder: '请输入',
    textAlign: 'right',
    upper: true,
  }

  componentWillMount() {
    const { form, id, initialValue, rules } = this.props
    const defaultStrValue = initialValue && initialValue.toString()
    this._getChineseAmount(defaultStrValue)
    this.fieldDecorator = getFieldDecorator(form, id, defaultStrValue, rules ? [...rules, 'money'] : ['money'])
github Ice-Hazymoon / MikuTools / pages / number_to_zh.vue View on Github external
hans() {
            const nzhcn = Nzh.cn;
            const nzhhk = Nzh.hk;
            let n = this.number;
            let data = [
                {
                    lang: 'cn',
                    data: [
                        {
                            name: '中文小写',
                            encode: [
                                nzhcn.encodeS(n),
                                nzhcn.encodeS(n, { tenMin: false })
                            ]
                        },
                        {
                            name: '中文大写',
                            encode: [

nzh

数字转中文,大写,金额

BSD-2-Clause
Latest version published 5 months ago

Package Health Score

62 / 100
Full package analysis

Popular nzh functions