-
Notifications
You must be signed in to change notification settings - Fork 33
Formatting an IBAN
skwasjer edited this page Jan 24, 2020
·
13 revisions
To convert an Iban
type to a string, call the ToString(string format)
method with either of 2 formats:
-
IbanNet.Iban.Formats.Flat
(default) IbanNet.Iban.Formats.Partitioned
IbanParser parser = new IbanParser(new IbanValidator());
Iban iban = parser.Parse("NL91 ABNA 0417 1643 00");
Debug.WriteLine(iban); // NL91ABNA0417164300
Debug.WriteLine(iban.ToString(Iban.Formats.Flat)); // NL91ABNA0417164300
Debug.WriteLine(iban.ToString(Iban.Formats.Partitioned)); // NL91 ABNA 0417 1643 00
By convention, it is recommended to use the flat format when persisting an IBAN in a database, file or otherwise.