strncmp Function

Compares two strings parts lexographically.

int strncmp(const char[] str1, const char[] str2, int num, bool caseSensitive)

Parameters

const char[] str1

First string (left).

const char[] str2

Second string (right).

int num

Number of characters to compare.

bool caseSensitive

If true (default), comparison is case sensitive. If false, comparison is case insensitive.

Return Value

-1 if str1 < str2 0 if str1 == str2 1 if str1 > str2