Best algorithm to sort the given values

Suppose I have the following values:-

xyz12@abc
xyz1@abc
xyz15@abc
xyz2@abc
xyz22@abc

I want the sorted output to be in form:-

xyz1@abc
xyz2@abc
xyz12@abc
xyz15@abc
xyz22@abc

If I use strcmp, then it will compare by each character and will give xyz1@ > xyz12 as @ > 2 which I don't want. What different algorithms can I use to sort this in the required format??

Answers


The Google keyword you're looking for is "natural sort".


Need Your Help

Socket connect() function explanation in C++/ Reference operator and Pointers

c++ c sockets pointers pass-by-reference

I'm new to programming and would like a better understanding of this socket function connect(). I've read many descriptions but I couldn't understand this syntax:

How to scrape multiple pages with an unchanging URL - python

python selenium selenium-webdriver web-scraping

I'm trying to scrape this website: http://data.eastmoney.com/xg/xg/