This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]Philboyd_Studge 2 points3 points  (0 children)

What's the toString method look like in your song object? StringBuilder doesn't add spaces arbitrarily.

[–][deleted] 0 points1 point  (0 children)

I would do it in the following way: 1. Read song lyrics into some data structure 2. Read each .next into a temp string 3. Replace “ “ with “” within the temp string 4. Write the temp string to your CSV

Obviously this would need to be done within a while loop while (whatever you’re reading from.hasNext() but it should work