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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:26:46+00:00 2026-06-13T15:26:46+00:00

please see the list below : string[] Separator = new string[] { __ };

  • 0

please see the list below :

    string[] Separator = new string[] { "__" };

    string[] lines_acc = File.ReadAllLines(accfilePath);
    List<string> list_lines_acc = new List<string>(lines_acc);

    List<string> list_lines_silver_count = new List<string>();
    FileStream fs_ = null;
    if (!File.Exists(silver_countfilePath))
    {
        using (fs_ = File.Create(silver_countfilePath))
        {
            foreach (string line_acc in list_lines_acc)
            {
                string[] line_acc_ar = line_acc.Split(Separator, StringSplitOptions.None);
                string line_acc_new = line_acc_ar[0] + "__" + line_acc_ar[1] + "__" + line_acc_ar[3] + "__" + line_acc_ar[4] + "__" + "0";
                list_lines_silver_count.Add(line_acc_new);
            }

            File.WriteAllLines(silver_countfilePath, list_lines_silver_count);
        }
    }
    else
    {
        string[] lines_silver_count = File.ReadAllLines(silver_countfilePath);
        list_lines_silver_count = new List<string>(lines_silver_count);
    }

i want to sort list_lines_silver_count by line_acc_ar[4] part!
that part is a string like -> 325423 -> mean i can convert it to an integer.
how can i do that job?

  • 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-06-13T15:26:47+00:00Added an answer on June 13, 2026 at 3:26 pm

    One way is to implement the comparer and provide it as an argument to the Sort function:

    public class SilverCountLineComparer : IComparer<string>
    {
        public int Compare(string x, string y)
        {
            string xPart = x.Split(new char[] {'_'}, StringSplitOptions.RemoveEmptyEntries)[3];
            string yPart = y.Split(new char[] {'_'}, StringSplitOptions.RemoveEmptyEntries)[3];
    
            int xNum = Int32.Parse(xPart);
            int yNum = Int32.Parse(yPart);
    
            return xNum.CompareTo(yNum);
        }
    }
    

    And to sort call it like this:

    list_lines_silver_count.Sort(new SilverCountLineComparer());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please see the following code: List list = Collections.synchronizedList(new ArrayList()); // ... synchronized (list)
Please see MSO question A long list of possible duplicates — C memory allocation
Please see my post on the Grails user mailing list. Essentially, I get the
Please see below code: thrust::device_vector<int>::iterator whereToBegin = copyListOfNgramCounteachdoc.begin(); end = thrust::unique_by_key(end.first, end.first + numUniqueNgrams,end.second);
Please see below: I tried using Absolute layout, but that's deprecated. I appreciate your
Please see the code snippet below : #include <iostream> using namespace std; int main()
I really want to get this out of my head. Please see below code:
Please see an example of my code below: CODE UPDATED public class ScrollableCheckboxList {
i am trying to make a colored dropdown list with colored items (please see
Please see the below code: I am have a table row defined using asp.net

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.