Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Determines if two strings are identical for up to a specified length of characters.

Files

lib_str.h/lib_str.c

Prototype

Arguments

p1_str

Pointer to the first string.

p2_str

Pointer to the second string.

len_max

Maximum number of string characters to compare.

Returned Value

Zero value,

if strings are identical; i.e., both strings are identical for the specified length of characters.

Positive value,

if p1_str is greater than p2_str; i.e., p1_str points to a character of higher value than p2_str for the first non-matching character found.

Negative value,

if p1_str is less than p2_str; i.e., p1_str points to a character of lesser value than p2_str for the first non-matching character found.

Required Configuration

None.

Notes / Warnings

String buffers not modified.

String comparison terminates if either string pointer points to or overlaps the NULL address.

Since 16-bit signed arithmetic is performed to calculate a non-identical comparison return value, CPU_CHAR native data type size must be 8-bit.

Example Usage

  • No labels