项目作者: bjansen

项目描述 :
A Java library that implements the SEPA conversion table provided by the EPC
高级语言: Java
项目地址: git://github.com/bjansen/sepa-conversion-tool.git
创建时间: 2019-01-09T09:54:08Z
项目社区:https://github.com/bjansen/sepa-conversion-tool

开源协议:GNU General Public License v3.0

下载


" class="reference-link">sepa-conversion-tool

A Java library that implements the SEPA conversion table
provided by the EPC

Example

  1. @Test
  2. void convertSample() {
  3. SepaCharacterConverter converter = SepaCharacterConverter.basicLatin();
  4. // characters that don't need conversion are preserved
  5. assertEquals("hello", converter.convertToSepaCharacters("hello"));
  6. // characters that need conversion are replaced
  7. assertEquals("Hello", converter.convertToSepaCharacters("Ħĕŀŀœ"));
  8. // characters that are outside of the range of the convertion table are dropped
  9. assertEquals("outside of range", converter.convertToSepaCharacters("outsi�de o�f r≧an∰g℗e"));
  10. }

Usage

The library can be imported to Maven projects like this:

  1. <dependency>
  2. <groupId>com.github.bjansen</groupId>
  3. <artifactId>sepa-conversion-tool</artifactId>
  4. <version>0.2.0</version>
  5. </dependency>

The next step is to choose your converter, and use it:

  1. SepaCharacterConverter converter = SepaCharacterConverter.basicLatin();
  2. // or SepaCharacterConverter.longTermSepa()
  3. String converted = converter.convertToSepaCharacters("Ħĕŀŀœ"); // will be converted to "Hello"