Admin Production ni-theme
Current Publication

CompareStrings

LabWindows/CVI

CompareStrings

int CompareStrings (char string1[], int string1Index, char string2[], int string2Index, int caseSensitive);

Purpose

Compares the NUL–terminated string that starts at position string#1Index of string#1 to the NUL–terminated string that starts at position string#2Index of string#2. string#1Index and string#2Index are zero–based.

CompareStrings returns an integer value that indicates the lexicographic relationship between the two strings.

Parameters

Input
Name Type Description
string1 char [] One of the two NUL–terminated strings whose contents are to be compared.
string1Index int Zero–based index specifying the location within string#1 at which to begin comparing bytes.
string2 char [] One of the two NUL–terminated strings whose contents are to be compared.
string2Index int Zero–based index specifying the location within string#2 at which to begin comparing bytes.
caseSensitive int Specify a nonzero value or select Yes in the function panel to match characters on a case-sensitive basis.

Specify 0 or select No in the function panel to match characters on a case-insensitive basis.

Return Value

Name Type Description
result int Indicates the lexicographical relationship between string#1 and string#2.
Code Description
–1 Bytes from string#1 are less than bytes from string#2.
0 Bytes from string#1 are identical to bytes from string#2.
1 Bytes from string#1 are greater than bytes from string#2.

Additional Information

Library: Formatting and I/O Library

Include file: formatio.h

LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later

Example

Refer to userint\listbox.cws for an example of using the CompareStrings function.