Closed yuuki0xff closed 4 years ago
Implemented by aa2fad958ba87dd0bc7b1e9f2316946f761534ab. To enable this feature, set sort_mode=3
in nvpy.cfg
.
Behavior:
In [1]: import nvpy.notes_db
In [2]: sorter = nvpy.notes_db.AlphaNumSorter()
In [3]: input_ = '''
...: 2a1
...: 5
...: 20a
...: 10
...: 2
...: 10a10b
...: 3
...: 1
...: 4
...: 10a1
...: '''.strip().splitlines()
In [4]: sorted(input_, key=lambda x: tuple(sorter._str2elements(x)))
Out[4]: ['1', '2', '2a1', '3', '4', '5', '10', '10a1', '10a10b', '20a']
See https://groups.google.com/forum/#!topic/nvpy/7Mp_p22dYvA
Expected result: