FLTK 1.4.5: numericsort.c File Reference

FLTK 1.4.5

Loading...
Searching...
No Matches
numericsort.c File Reference
`#include <ctype.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <FL/platform_types.h>`
`#include <FL/filename.H>`
`#include <FL/fl_utf8.h>`

## Functions
int | fl_casenumericsort (struct dirent **A, struct dirent **B)
| Compares directory entries alphanumerically (case-insensitive).
int | fl_numericsort (struct dirent **A, struct dirent **B)
| Compares directory entries alphanumerically (case-sensitive).

## Function Documentation

## ◆ fl_casenumericsort()

int fl_casenumericsort | ( | struct dirent ** | A,
|  | struct dirent ** | B )

Compares directory entries alphanumerically (case-insensitive).

Note
  This comparison is UTF-8 aware.

See also
  fl_numericsort()

## ◆ fl_numericsort()

int fl_numericsort | ( | struct dirent ** | A,
|  | struct dirent ** | B )

Compares directory entries alphanumerically (case-sensitive).

Numbers are compared without sign, i.e. "-" is not taken as a sign of following numerical values. The following list of files would be in ascending order (examples are ASCII and numbers only for simplicity):

1. 1zzz.txt
2. 2xxx.txt
3. 19uuu.txt
4. 100aaa.txt
5. file1z.txt
6. file5a.txt
7. file5z.txt
8. file30z.txt
9. file200a.txt
10. temp+5.txt ('+' is lexically lower than '-')
11. temp-5.txt ('-' is not a sign)
12. temp-100.txt (100 is bigger than 5, no sign)

Parameters

  [in] | A | first directory entry
  [in] | B | second directory entry

Returns
  comparison result (-1, 0, or +1)

Return values

  -1 | A < B
  0 | A == B
  +1 | A > B

Note
  This comparison is UTF-8 aware.

See also
  fl_casenumericsort()