| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Typedefs | Functions
strnatcmp.h File Reference
`#include "ws_symbol_export.h"`

Go to the source code of this file.

## Typedefs
typedef char | nat_char

## Functions
WS_DLL_PUBLIC int | ws_ascii_strnatcmp (nat_char const *a, nat_char const *b)
| Performs ASCII natural-order string comparison (case-sensitive).
WS_DLL_PUBLIC int | ws_ascii_strnatcasecmp (nat_char const *a, nat_char const *b)
| Performs ASCII natural-order string comparison (case-insensitive).

## Detailed Description

Original code downloaded from: http://sourcefrog.net/projects/natsort/

strnatcmp.c – Perform 'natural order' comparisons of strings in C. Copyright (C) 2000, 2004 by Martin Pool <mbp sourcefrog net>

SPDX-License-Identifier: Zlib

## Function Documentation

## ◆ ws_ascii_strnatcasecmp()

WS_DLL_PUBLIC int ws_ascii_strnatcasecmp | ( | nat_char const * | a,
|  | nat_char const * | b )

Performs ASCII natural-order string comparison (case-insensitive).

Compares two strings using "natural" ordering, ignoring case differences. Numeric substrings are compared by numeric value.

Parameters

  a | First string to compare.
  b | Second string to compare.

Returns
  An integer similar to strcasecmp():
  - < 0 if a < b
  - 0 if a == b
  - > 0 if a > b

## ◆ ws_ascii_strnatcmp()

WS_DLL_PUBLIC int ws_ascii_strnatcmp | ( | nat_char const * | a,
|  | nat_char const * | b )

Performs ASCII natural-order string comparison (case-sensitive).

Compares two strings using "natural" ordering, where numeric substrings are compared based on their numeric value rather than lexicographic order. For example, "file2" comes before "file10".

Parameters

  a | First string to compare.
  b | Second string to compare.

Returns
  An integer similar to strcmp():
  - < 0 if a < b
  - 0 if a == b
  - > 0 if a > b