mercredi 1 avril 2015

C++ sorting - special characters after normal letters

I have a vector of strings which is holding strings like



BB
aA
12
b
AA
&
[
**
1


Using the default sort() with C++ I am given this sorted list



&
**
1
12
AA
BB
[
aA
b


Instead of that, I need it to be ordered with the normal letters A, a, B, b.... coming first, those followed by 0-9 and finally all that being followed by the "special" characters like *, [, , ~, !.... in their normal ASCII order.


I really have no idea how to go about changing the way that the vector is sorted in order to make sure that it is all in that order. Thanks.


Aucun commentaire:

Enregistrer un commentaire