0

I want to know which is cost more space when store in file. I have to store a very long sequence of string with separator. I also care about file size so which is cost less space than the other. line breaks or comma? Thanks

chickensoup
  • 306
  • 1
  • 16
  • 1
    A comma will never occupy more than a line break. But if you are concerned about space, you should probably choose a binary format, or compress the contents. – IInspectable Apr 21 '17 at 14:25

1 Answers1

1

If you're using a Windows platform, then a newline consists of a carriage return + line feed character, as so:

\r\n

On a Unix (and Mac) they only use a line feed character for a newline:

\n

So the answer to your question is "it depends on which operating system you are using".

Answer prompted by this StackOverflow post.

For future reference, you should put a little more detail into your questions including the OS to be used and what research you have already carried out.

Community
  • 1
  • 1
Neil Stoker
  • 309
  • 4
  • 16