Natural sort in C - “array of strings, containing numbers and letters”

后端 未结 4 818
被撕碎了的回忆
被撕碎了的回忆 2021-01-24 06:34

Looking for a proven to work algorithm for production. Did see this example but not finding much else on the web or in books.

i.e. file_10.txt > file_2.txt

Thank

4条回答
  •  孤城傲影
    2021-01-24 07:28

    The basic sort function would be standard C qsort(). It is parameterized to take a comparison function, and the comparison function is what you would need to write to do the natural ordering.

    Your cross-referenced question includes a C implementation of a comparison function.

    A Google search 'natural sort c' shows a SourceForge implementation.

提交回复
热议问题