Goto main content

strncmp

Comparison of the first n characters.

STRNCMP

NAME

strncmp - Comparison of the first n characters.

SYNOPSIS

strncmp(str1,str2,len)

PARAMETERS

str1
The first string.
str2
The second string.
len
The length

RETURN

Returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.

EXAMPLES

in:  res=<{strncmp("one ","ONE SAMPLE",4)}>.
out: res=32.

in:  res=<{strncmp("ONE ","ONE SAMPLE",4)}>.
out: res=0.

in:  res=<{strncmp("ONE SAMPLE","ONE ",4)}>.
out: res=0.

SEE ALSO

{{ include("includes/strings.sn") }}

AUTHOR

Written by Pusnei Sergey and Caroline Laplante, <sergey@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2022 extenso Inc. All rights reserved.