number_to_chinese 1.0.0

number_to_chinese #

A api to covert number to tradition chinese

Usage #

To use this plugin, add number_to_chinese as a dependency in your pubspec.yaml file.

Example #

import 'package:number_to_chinese/number_to_chinese.dart';

void main() {

  print(NumberToCht().doubleToCht(120.34502)); // 壹佰貳拾元參分肆釐伍毫零貳忽
  print(NumberToCht().doubleToCht(122.3));     // 壹佰貳拾貳元參分
  print(NumberToCht().doubleToCht(12200.3));   // 壹萬貳仟貳佰零伍元參分

  print(NumberToCht().intToCht(103));      // 壹佰零參
  print(NumberToCht().intToCht(1003));     // 壹仟零參
  print(NumberToCht().intToCht(1034));     // 壹仟零參拾肆
  print(NumberToCht().intToCht(10045));    // 壹萬零肆拾伍
  print(NumberToCht().intToCht(12050789)); // 壹仟貳佰零伍萬零柒佰捌拾玖
  print(NumberToCht().intToCht(1234567890123456789));

  //壹佰貳拾參京肆仟伍佰陸拾柒兆捌仟玖佰零壹億貳仟參佰肆拾伍萬陸仟柒佰捌拾玖
}

[0.0.1]

  • Initial release.

example/lib/main.dart

import 'package:number_to_chinese/number_to_chinese.dart';

void main() {

  print(NumberToCht().doubleToCht(120.34502)); // 壹佰貳拾元參分肆釐伍毫零貳忽
  print(NumberToCht().doubleToCht(122.3));     // 壹佰貳拾貳元參分
  print(NumberToCht().doubleToCht(12200.3));   // 壹萬貳仟貳佰零伍元參分

  print(NumberToCht().intToCht(103));      // 壹佰零參
  print(NumberToCht().intToCht(1003));     // 壹仟零參
  print(NumberToCht().intToCht(1034));     // 壹仟零參拾肆
  print(NumberToCht().intToCht(10045));    // 壹萬零肆拾伍
  print(NumberToCht().intToCht(12050789)); // 壹仟貳佰零伍萬零柒佰捌拾玖
  print(NumberToCht().intToCht(1234567890123456789));

  //壹佰貳拾參京肆仟伍佰陸拾柒兆捌仟玖佰零壹億貳仟參佰肆拾伍萬陸仟柒佰捌拾玖
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  number_to_chinese: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:number_to_chinese/number_to_chinese.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
7
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
53
Learn more about scoring.

We analyzed this package on Jul 10, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/number_to_chinese.dart.

Run flutter format to format lib/number_to_chinese.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
Dev dependencies
flutter_test

Admin