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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:01:28+00:00 2026-05-25T10:01:28+00:00

I have some text that contains numerous values like so: PartNumber Description Amount Fid1

  • 0

I have some text that contains numerous values like so:

PartNumber    Description    Amount
Fid1          blahblahblah   999934109
0603          moreblah       12
exclude       ehh?           981
FID5          fillertext     123
fid2          fillertext     123
fid           fillertext     123
0603          fillertext     123
0603          fillertext     123
0603          fillertext     123
0402          fillertext     123
0402          fillertext     123
//etc.........etc............etc

I would like to print out the values that contain “FID”

int j = 1;
foreach (var line in theList)
{
    if (line.PartNumber.ToUppeR().Contains("FID"))
    {
        sw.WriteLine("{0}: {1} {2} {3}", 
                       j,
                       line.PartNumber,
                       line.Amount,
                       line.Description);
        j++;
    }
}

However, when I do this, it prints them out as follows:

1: Fid1 999934109 blahblahblah
2: FID5 123 fillertext
3: fid2 123 fillertext
4: fid 123 fillertext

and I would like to print them out numerically.. so like this:

1: fid 123 fillertext
2: Fid1 999934109 blahblahblah
3: fid2 123 fillertext
4: FID5 123 fillertext

Is there an easy, quicky way to do this?

  • 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-25T10:01:29+00:00Added an answer on May 25, 2026 at 10:01 am

    You could probably use the orderby clause of a LINQ query against theList:

    int garbage;
    from line in theList
    where line.PartNumber.ToUpper().StartsWith("FID")
    orderby (Int32.TryParse(line.PartNumber.Substring(3),garbage)) ? (Int32.Parse(line.PartNumber.Substring(3))) : 0
    select line;
    

    You wouldn’t need the if statement in your foreach, then, either.

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

Sidebar

Related Questions

I have Tab Layout that contains a TextView. I'd like to assign some text
I have a description column in my SQLite database that contains some text to
Say I have a file, that contains some text. There are substrings like substr1,
I have a string that contains some text with periods and commas. I'd like
I have a custom Dialog that contains only a TextView to display some text
I have a text file that contains some strings separated by ,. Strings are
I have some text that I always need to display (like a HUD). When
I have some text that is stored in a variable like this: <div class=foo>text
I have some text that uses Unicode punctuation, like left double quote, right single
I have that contains some text entered dynamically by the user from a web

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.