Closed trilleplay closed 3 months ago
Thanks for contributing! For completeness there should also be an appendString method that appends a string, similar to how saveLines also has a counterpart saveString. Ideally this would use the underlying appendability in java.io, see e.g. https://stackoverflow.com/a/24982850 See also https://github.com/lunduniversity/introprog-scalalib/issues/47
Thanks for contributing! For completeness there should also be an appendString method that appends a string, similar to how saveLines also has a counterpart saveString. Ideally this would use the underlying appendability in java.io, see e.g. https://stackoverflow.com/a/24982850 See also #47
It's been a while, but I've made the requested changes to my PR, I think I've written something that is what you're looking for @bjornregnell .
@trilleplay You may want to see the correct implementation here to handle both empty seq and trailing newline: https://github.com/lunduniversity/introprog-scalalib/commit/482dcceaa4395504f4b10d9551391874ac313264
I have also added some tests: https://github.com/lunduniversity/introprog-scalalib/commit/c80904a2da4899c33d66449eac5e1dc4a01ccec6
After reading though https://github.com/lunduniversity/introprog/issues/782 I think that some of the issues associated with Bank's saving and loading could be addressed by introducing a method that lets the user easily append to text files (since it might feel natural to do so in doEvent.)
I propose that a method be added for appending lines.