Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 535647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:44:19+00:00 2026-05-13T09:44:19+00:00

I need to sort filenames that can have a common root, but are then

  • 0

I need to sort filenames that can have a common root, but are then followed by numbers that are not necessarily padded uniformely; one example is what you obtain when you rename multiple files in Windows.

filenamea (1).txt
filenamea (2).txt
…
filenamea (10).txt
…
filenamea (100).txt
…
filenameb.txt
…
filenamec (1).txt
filenamec (2).txt

and so on…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:44:19+00:00Added an answer on May 13, 2026 at 9:44 am

    There are already similar questions, I know of Sort on a string that may contain a number and How to implement a natural sort algorithm in C. So you can also look there for more inspiration and help.

    Both questions’ answers suggest, http://www.davekoelle.com/alphanum.html, which is basically what Pascal Cuoq suggested.

    You can also look at the Coding Horror article, where some other algorithms are linked: Sorting for Humans : Natural Sort Order

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array of filenames and need to sort that array by the
I need to sort an array that can look like this: $array[4][0] = array('id'
I need to sort then print the result increasing and decreasing. I have some
I have filenames in following format: [ignore-prefix]-[important-middle]-[ignore-suffix]-[name-with-digits] I need to sort according to following
I need to sort nodes in xml. I have the following code which successfully
Assume PHP/MYSQL but I don't necessarily need actual code, I'm just interested in the
I have a set of, oh 8000 or so files, that I need to
I need to sort file names as follows: 1.log, 2.log, 10.log But when I
I need to sort a matrix so that all elements stay in their columns
I need to sort a flat file by third column leaving first column intact

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.