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

  • Home
  • SEARCH
  • 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 3281624
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:50:10+00:00 2026-05-17T19:50:10+00:00

I am lookind for a effective way that I can replace newlines with an

  • 0

I am lookind for a effective way that I can replace newlines with an auto-incrementing number.

eg.

this is line 1
this is line 2
this is line 3
this is line 4

to

1. this is line 1
2. this is line 2
3. this is line 3
4. this is line 4

Is looping through each line the only way? I guess thats the way I will implement it for now. Unless I find a better way here 🙂 Just some pseudo code will do. But I am using C#

  • 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-17T19:50:10+00:00Added an answer on May 17, 2026 at 7:50 pm

    You can use LINQ:

    string[] lines = ...
    
    string newText = string.Concat(lines.Select(
                         (line, index) => string.Format("{0}. {1}", index, line)));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this text file that contains approximately 22 000 lines, with each line
I am looking for easy steps that are simple and effective in making a
I am looking for an effective way to either clone/rename or re-create address fields
We have customers asking for apps that can run on both iPhone and Android.
The intent is to create a set of web services that people can reuse.
Is there a way within asp.net MVC 2 whereby I can route a request
I am looking for an effective way to receive feedback from users from within
I have a business app that I have written, that effectively recurses through a
I'm looking for some way to effectively hide inherited members. I have a library
I'm looking for a cost effective tool for managing an web app on Ec2.

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.