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 3619206
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:50:59+00:00 2026-05-18T22:50:59+00:00

I looked through the website, couldn’t find anything that specifically addressed the issue. I

  • 0

I looked through the website, couldn’t find anything that specifically addressed the issue.

I have a console app that loops through, finds strings between 7-20 characters, plus date/time, plus a Flag, plus the file.

    Console.Write("=========================================================================");
Console.WriteLine("Start time: " + DateTime.UtcNow);
Console.Write("=========================================================================");
Console.WriteLine("All times in UTC.");
Console.Write("=========================================================================");
Console.WriteLine(String.Format("{0,-8}{1,17}{2,37}{3,13}", "Time", "File:Offset", "F", "String"));
Console.Write("=========================================================================");

The problem is the string and filename+path can be varying length. The Output uses the same string format, but depending on the length of the filename, the formatting is off.

Is there a way to have the console write items starting at a fixed position everytime.
So Time starts at 0, file:offsett starts at 17, F starts at 37, and String starts at 40. That way it formats properly. Also, this may be a bit more advanced, but can it truncate anything that won’t fit in the column?

Thanks!

  • 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-18T22:51:00+00:00Added an answer on May 18, 2026 at 10:51 pm

    You could use the PadLeft string function in c# to achieve what you want

    more info here http://msdn.microsoft.com/en-us/library/system.string.padleft(v=vs.71).aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I looked through the related questions and couldn't find anything that addresses exactly what
I looked through the Django built-in Auth app and noticed that views are split
I looked through some code and noticed that the convention was to turn pointer
I looked through the other posts and bug reports and couldn't figure out what's
I looked through the existing questions of this kind but didn't find what I
I've looked through all the class documentation for Core Data and I can't find
I have looked through several sites for any useful documentation and have come up
ive looked through the wxpython website however I do not believe it has the
I wanna diplay a Stopwatch timer... using Asp.Net C#... I have looked through many
I have looked through various answers here, but am still unable to figure it

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.