Extracted convertReservedXmlCharacters() and convertDiacritics()
This commit is contained in:
parent
08d3cfbd66
commit
97e7d44a47
|
@ -5,14 +5,16 @@ interface ISepaMessageCreator {
|
|||
|
||||
fun createXmlFile(messageTemplate: PaymentInformationMessages, replacementStrings: Map<String, String>): String
|
||||
|
||||
fun convertDiacriticsAndReservedXmlCharactersAndCheckIfContainsOnlyAllowedCharacters(stringToTest: String): Boolean {
|
||||
val convertedString = convertDiacriticsAndReservedXmlCharacters(stringToTest)
|
||||
|
||||
return containsOnlyAllowedCharacters(convertedString)
|
||||
}
|
||||
|
||||
fun containsOnlyAllowedCharacters(stringToTest: String): Boolean
|
||||
|
||||
fun convertDiacriticsAndReservedXmlCharacters(input: String): String
|
||||
fun convertDiacriticsAndReservedXmlCharacters(input: String): String {
|
||||
var converted = convertDiacritics(input)
|
||||
|
||||
return convertReservedXmlCharacters(converted)
|
||||
}
|
||||
|
||||
fun convertReservedXmlCharacters(input: String): String
|
||||
|
||||
fun convertDiacritics(input: String): String
|
||||
|
||||
}
|
|
@ -37,7 +37,7 @@ open class SepaMessageCreator : ISepaMessageCreator {
|
|||
&& convertDiacriticsAndReservedXmlCharacters(stringToTest) == stringToTest
|
||||
}
|
||||
|
||||
override fun convertDiacriticsAndReservedXmlCharacters(input: String): String {
|
||||
override fun convertReservedXmlCharacters(input: String): String {
|
||||
// TODO: add other replacement strings
|
||||
return input
|
||||
.replace("\"", """)
|
||||
|
@ -45,8 +45,11 @@ open class SepaMessageCreator : ISepaMessageCreator {
|
|||
.replace("&", "&")
|
||||
.replace("<", "<")
|
||||
.replace(">", ">")
|
||||
}
|
||||
|
||||
override fun convertDiacritics(input: String): String {
|
||||
return input
|
||||
|
||||
// convert diacritics
|
||||
.replace("á", "a", true)
|
||||
.replace("à", "a", true)
|
||||
.replace("â", "a", true)
|
||||
|
|
Loading…
Reference in New Issue