Skip to content

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

License

Notifications You must be signed in to change notification settings

bjansen/sepa-conversion-tool

Repository files navigation

sepa-conversion-tool

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

Example

@Test
void convertSample() {
	SepaCharacterConverter converter = SepaCharacterConverter.basicLatin();

	// characters that don't need conversion are preserved
	assertEquals("hello", converter.convertToSepaCharacters("hello"));

	// characters that need conversion are replaced
	assertEquals("Hello", converter.convertToSepaCharacters("Ħĕŀŀœ"));

	// characters that are outside of the range of the convertion table are dropped
	assertEquals("outside of range", converter.convertToSepaCharacters("outsi�de o�f r≧an∰g℗e"));
}

Usage

The library can be imported to Maven projects like this:

<dependency>
	<groupId>com.github.bjansen</groupId>
	<artifactId>sepa-conversion-tool</artifactId>
	<version>0.2.0</version>
</dependency>

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

SepaCharacterConverter converter = SepaCharacterConverter.basicLatin(); 
// or SepaCharacterConverter.longTermSepa()

String converted = converter.convertToSepaCharacters("Ħĕŀŀœ"); // will be converted to "Hello"