Function _conCompareStr() Foundation

Compares two strings up to the specified length.

Syntax
LONG _conCompareStr(char *ps1, ULONG nlen1,
                    char *ps2, ULONG nlen2);
Parameters
char *ps1
Pointer to the first character string (may contain NULL characters).
ULONG nlen1
Length of the first character string.
char *ps2
Pointer to the second character string (may contain NULL characters).
ULONG nlen2
Length of the second character string.
Return

A negative value is returned when ps1 < ps2. NULL is returned when ps1 = ps2. A positive value is returned if ps1 > ps2.

Description

This function compares two strings and incorporates the current values of SET EXACT and SET LEXICAL. Each string can contain any characters including NULL characters.

Examples
/* 
   Compare two NULL terminated strings 
*/ 
#include <xppcon.h> 
#include <string.h> 

XPPAPIRET       xr; 
CHAR           *ps1, ps2; 

/* 
   Initialize string pointers ... 
*/ 

xr = _conCompareStr( ps1, strlen(ps1), ps2, strlen(ps2) ); 
if (xr < 0) 
   /* ps1 less than ps2 ... */ 
else if (xr > 0) 
   /* ps1 greater than ps2 ... */ 
else 
   /* ps1 equal to ps2 ... */ 

/* 
   Release of string pointers ... 
*/ 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.