Capital letters sorting incorrectly? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Capital letters sorting incorrectly?

So someone else typed this code. I don't fully understand it, but I understand more than I did before he gave me this. But why are capital letters sorting incorrectly and how can I fix this? For an example, try and alphabetically sort "aCb" It sorts as "Cab" but if we type "acb", it sorts correctly. https://code.sololearn.com/WkOPxi62VxAy/?ref=app

22nd Jul 2018, 7:27 AM
Daniel Cooper
Daniel Cooper - avatar
6 Answers
+ 3
Hi, "Someone else" is still here..Lol https://code.sololearn.com/WGmF39mkVoNC/?ref=app
22nd Jul 2018, 8:32 AM
Calviղ
Calviղ - avatar
+ 1
capital letters have lower values in ASCII table, so they will be always first.
22nd Jul 2018, 7:29 AM
Jakub Stasiak
Jakub Stasiak - avatar
+ 1
Thanks Calviղ I learned a lot about arrays in this process. I don't fully understand the code though, but i'll keep looking at it until I can fully understand it. Also this entire code is pretty much yours at this point xD
22nd Jul 2018, 5:15 PM
Daniel Cooper
Daniel Cooper - avatar
+ 1
Daniel Cooper Don't worry, the code belongs to you. my code is in private. All my QnA codes are private codes.
23rd Jul 2018, 12:57 AM
Calviղ
Calviղ - avatar
0
Is there a way I can fix this?
22nd Jul 2018, 8:01 AM
Daniel Cooper
Daniel Cooper - avatar
0
Lol. Sup my dude. Long time no see xD
22nd Jul 2018, 8:55 AM
Daniel Cooper
Daniel Cooper - avatar