[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


strcoll

Compare two character arrays according to locale.

Compatibility:

This function is compatible with the following targets:

ANSI

BeOS

EMB/RTOS

Mac OS

Palm OS

Win32


Prototype:
#include <string.h>
int strcoll(const char *s1, const char *s2);
Parameters:

Parameters for this facility are:

s1  
const char *  
The string to compare  
s2  
const char *  
The comparison string  

Remarks:

The strcoll() function compares two character arrays based on the collating sequence set by the locale.h header file.

The Metrowerks C implementation of strcoll() compares two character arrays using strcmp(). It is included in the string library to conform to the ANSI C Standard Library specification.

Return:

strcoll() returns zero if s1 is equal to s2, a negative value if s1 is less than s2, and a positive value if s1 is greater than s2.

See Also:

"Locale specification"

"memcmp"

"strcmp"

"strncmp",

Example of strcoll() usage.:
#include <string.h>
#include <stdio.h>

int main(void)
{
	static char s1[] = "aardvark", s2[] = "xylophone";
	int result;
	
	result = strcoll(s1, s2);

	if (result < 1)
		printf("%s is less than %s\n", s1, s2);
	else
		printf("%s is equal or greater than %s\n", s1, s2);

	return 0;
}

Output:
aardvark is less than xylophone


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 16, 2000