Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4266726
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:48:01+00:00 2026-05-21T06:48:01+00:00

I have a stringbuilder object, that a line of data gets added to. after

  • 0

I have a stringbuilder object, that a line of data gets added to.

after each line gets added, I append a “\n” on the end to indicate a new line.

this stringbuilder object, finalised, gets written to a flat file.

When I open the flat file in notepad I get a small rectangle after every line and the column formatting is ruined.

When I open the flat file in wordpad, the new line is taken into consideration and the column formatting is perfect.

I have tried all ways I know of removing the new line entry before it gets written, but this removes the formatting when written to the flat file. I need the new line for the formatting of the columns.

how can I output the file with new lines but without using \n?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T06:48:02+00:00Added an answer on May 21, 2026 at 6:48 am

    The Windows way of terminating a line is to use “\r\n”, not just “\n”.

    You can find the “line separator for the current operating system” using the line.separator system property:

    String lineSeparator = System.getProperty("line.separator");
    ...
    StringBuilder builder = new StringBuilder();
    ...
    builder.append(lineSeparator);
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a StringBuilder object var sb = new StringBuilder(); And an arbritrary
I'm have a StringBuilder that is writing content to a file. Towards the end
I have this inside my DAO public String CSNSurvey() { StringBuilder mailstr = new
I have this code to create an ATOM feed Dim xmlResult As New StringBuilder
I have a Stringbuilder object that has been populated from a text file. How
Let's say I have an object MyObject that looks like this: public class MyObject
I have a StringBuilder object that needs to be trimmed (i.e. all whitespace chars
Have following Java code,that creates StringBuilder with \n,i.e. carriage return delimiters: while (scanner.hasNextLine()){ sb.append(scanner.nextLine()).append(\n);
I have an object model that looks like this: public MyObjectInJson { public long
I have the following: StringBuilder errors = new StringBuilder(); if(IsNullOrEmpty(value)) { errors.AppendLine(Enter value); }

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.