Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lack of easy way to append to text files. #45

Closed
trilleplay opened this issue Dec 12, 2023 · 4 comments
Closed

Lack of easy way to append to text files. #45

trilleplay opened this issue Dec 12, 2023 · 4 comments

Comments

@trilleplay
Copy link
Contributor

After reading though lunduniversity/introprog#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.

@bjornregnell
Copy link
Member

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

@trilleplay
Copy link
Contributor Author

trilleplay commented Feb 8, 2024

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 .

@bjornregnell
Copy link
Member

@trilleplay You may want to see the correct implementation here to handle both empty seq and trailing newline: 482dcce

@bjornregnell
Copy link
Member

I have also added some tests: c80904a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants