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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:30:05+00:00 2026-05-11T15:30:05+00:00

If I have two strings, and I need to compare them in ASCII order

  • 0

If I have two strings, and I need to compare them in ASCII order (instead of the invariant culture order) I can generally use:

int c = String.Compare(a, b, StringComparison.Ordinal); 

If I have a DataTable, and I want one of the columns sorted using an Ordinal string comparison for the DataView , how do I go about it?

  • 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. 2026-05-11T15:30:05+00:00Added an answer on May 11, 2026 at 3:30 pm

    Unfortunately, there’s nothing built-in to facilitate custom sorting logic in the DataView; that’s been one of my chief complaints, and one of the reasons that we decided to roll our own data access layer at my old job.

    While I don’t know how feasible this would be for you to do, to really achieve this you’d need to add another column to your table as an int, then sort the rows in an array based upon your own comparison logic, then store the index in the array in your int column. Then, rather than ordering by the string column order by the int column.

    I do recognize, however, that this doesn’t satisfy things like automatic sorting that gets done by a GridView and it doesn’t account for changes to the data that take place after you calculate the sorting positions. Unfortunately, I don’t think there’s anything that can really help with this.

    If you’re looking to sort this visually, check and see if your visual control supports a custom sorting mechanism. That’s about all I can suggest.

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

Sidebar

Related Questions

I have this two strings of equal length, which I need to compare. I
I have two strings that i need to compare, but even if they have
So I have a dilemma. I need to compare two C-style strings and I
I have two strings and would like to display the difference between them. For
I have two arrays (or arraylists if it is easier) of strings. I need
In a follow-up to this question , I need to compare two strings in
I have two documents with a simple schema that I need to compare: current
I have run into a situation where I need to compare two different lists
I have two objects of a class. I need to compare each field with
I have two strings. stringV1 = 123456; stringV2 = 102300456; First I need to

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.