How to sort out numeric strings as numerics?

前端 未结 6 2026
面向向阳花
面向向阳花 2020-12-30 09:04

If you have strings like:

\"file_0\"
\"file_1\"
\"file_2\"
\"file_3\"
\"file_4\"
\"file_5\"
\"file_6\"
\"file_11\"

how can you sort them so

6条回答
  •  太阳男子
    2020-12-30 09:25

    You could import the StrCmpLogicalW function and use that to sort the strings. This is the very same function that Explorer itself uses for file names.

    Won't help you if you don't want P/Invoke or stay compatible on other systems, though.

提交回复
热议问题