code refactor

This commit is contained in:
MaysWind
2024-09-11 00:57:16 +08:00
parent 031209490f
commit 2cffd4fbbb
6 changed files with 49 additions and 45 deletions
@@ -100,6 +100,17 @@ func (b *ezBookKeepingTransactionPlainTextDataTableBuilder) AppendTransaction(da
b.builder.WriteString(fmt.Sprintf(b.dataLineFormat, dataRowParams...))
}
// ReplaceDelimiters returns the text after removing the delimiters
func (b *ezBookKeepingTransactionPlainTextDataTableBuilder) ReplaceDelimiters(text string) string {
text = strings.Replace(text, "\r\n", " ", -1)
text = strings.Replace(text, "\r", " ", -1)
text = strings.Replace(text, "\n", " ", -1)
text = strings.Replace(text, b.columnSeparator, " ", -1)
text = strings.Replace(text, b.lineSeparator, " ", -1)
return text
}
// String returns the textual representation of this data
func (b *ezBookKeepingTransactionPlainTextDataTableBuilder) String() string {
return b.builder.String()