Hey ppl!
i have strings in a program that are like this
LL-NN-NN, NN-LL-NN and NN-NN-LL
The final order that i want to show is LL-NN-NN, NN-NN-LL and finally NN-LL-NN
how can i do this right ?
can someone give me ideas ?
Thanks
This is a discussion on Problem in order strings with letters and numbers within the C Programming forums, part of the General Programming Boards category; Hey ppl! i have strings in a program that are like this LL-NN-NN, NN-LL-NN and NN-NN-LL The final order that ...
Hey ppl!
i have strings in a program that are like this
LL-NN-NN, NN-LL-NN and NN-NN-LL
The final order that i want to show is LL-NN-NN, NN-NN-LL and finally NN-LL-NN
how can i do this right ?
can someone give me ideas ?
Thanks
That's an interesting choice. In that case you'll want to write a sort function that first categorizes the string into one of those three types (say hello to isalpha() and isdigit()), then if it gets two of the same type, checks the actual numbers/letters themselves depending on how you want them sorted.
Once you have that written, you can use it in your sort routine where you would have put < (or >, whichever you were using).