Giter Club home page Giter Club logo

iban's Introduction

iban

Validate IBANs

Build Status

Usage

A simple usage example:

import 'package:iban/iban.dart';

void main() {
  final iban = 'at61 1904 3002 3457 3201';

  if (isValid(iban)) {
    print('$iban is a valid iban');
  } else {
    print('$iban is not a valid iban');
  }

  if (isValid(iban, sanitize: false)) {
    print('$iban without sanitization is a valid iban.');
  } else {
    print('$iban without sanitization is not a valid iban.');
  }

  print('Convert the IBAN into a standard format: ${electronicFormat(iban)}');
  print('To display an IBAN to a user we have: ${toPrintFormat(iban)}');
}

Iban specifications

The iban specifications are copied from iban.js

See specifications.dart for all available countries.

Contrary to iban.js, which parses the specifications at runtime, all regular expression strings are parsed using specifications_builder.dart.

Please open an issue if you notice that my specifications are out of sync with iban.js or if you know how to build the iban for another country.

iban's People

Contributors

alexrintt avatar close2 avatar haarts avatar keppelerj avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

iban's Issues

Bug when validating a short input with special character

When calling isValid('_a') the function call results in a RangeError: Value not in range: 2`.

This happens because the iban length in isValid is checked before removing special characters and therefore specifications[iban.substring(0, 2)] will run into a RangeError

Issue in Swiss iban spec

Hi

In the iban package is an error with the swiss iban specification.
The package wants the swiss iban to have a number at the last digit of the iban. Valid can also be a character.
see on this page:
https://www.ubs.com/ch/en/help/account/iban.html
Open segment: Where do I find the IBAN for my UBS account?

Could you update the specs to support ubs accounts as well?

Best regards

Replacement before validate IBAN

in iban.dart
var iban = electronicFormat(_iban);

is iban != _iban , electronicFormat() remove some invalid chars. Example : _iban = "DE021203000000002ΓΌ02051", after electronicFormat() is iban = "DE02120300000000202051" and is valide! The function isValid return now true but the iban is not valide.

Migrate to null safety

Hi @close2,

just read you're 'help wanted' commit when i was about to open a pull request for the Dart 2.12 migration.
Changes look good to me - i made the same changes, ran dart test and analyze and all seems fine. Thanks for updating.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.