Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
String Sorting Algorithm
#1
I've been trying to write a string sorting algorithm for the past few days.

I'm using a lanugage that does not have any built-in functions that sort the way I want to sort.

The strings will contain alpha and numeric characters.

Here's an example of what I want to do:

Let's say we have a file with the following strings:

TEST, BELT, 40E, A1, A2, 1, 2,3, 4, 1A, 1D, 2D, 65A, 3D, 4D, 10D, 1E, 20D, 30D, 40D, 41D, 1D1


The user is able to choose a minimum and maximum.

For example, user enters
Min: 1D
Max: 40D

and it should pull the following:
1D, 2D, 3D, 4D, 10D, 20D, 30D, 40D

(in that order)


I'm guessing it would be similar to the StrCmpLogicalW function, but I would like it to not be case sensitive.

I would appreciate the help.
Reply
#2
I figured it out!

Thanks.
Reply
#3
Glad i could help, i made a few sorting algorithms in programming class. I was going to talk to you about it the next time i saw you cause i was too lazy to type out what i was thinking at that point in time.:D
Reply
#4
' Wrote:Glad i could help, i made a few sorting algorithms in programming class. I was going to talk to you about it the next time i saw you cause i was too lazy to type out what i was thinking at that point in time.:D

Well, i didn't really write a string sorting algorithm.
It only compares two strings and finds which is greater based on natural sorting.
It could be used to sort, which I can see us using it for that in the near future.
Reply
#5
Yup, thats what my suggestion was going to be actualy. Exactly how i did it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)