Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

strxfrm(3) [osf1 man page]

strxfrm(3)						     Library Functions Manual							strxfrm(3)

NAME
strxfrm - Transforms string for collation in current locale LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <string.h> size_t strxfrm( char *s1, const char *s2, size_t n); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: strxfrm(): XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the destination string. Specifies the string to be transformed. Specifies the maximum number of bytes to store in the trans- formed string. DESCRIPTION
The strxfrm() function transforms the string pointed to by the s2 parameter into an internal form suitable for collation and places the result in the address specified by s1. This transformation is performed as appropriate to the LC_COLLATE category of the current locale. When the strcmp() function is applied to two transformed strings, a value greater than, equal to, or less than 0 (zero) is returned. The returned value corresponds to the same value that is returned when the strcoll() function is applied to the same two original transformed strings. The transformed string can be longer than the original string. No more than n characters are placed in the location pointed to by the s1 parameter, including the terminating null character. When n is 0 (zero), the s1 parameter can be a null pointer. When operating on overlapping strings, the behavior of this function is unreliable. NOTES
If you are doing multiple comparisons using the same set of text strings, the strxfrm() transformation function in conjunction with the strcmp() function may be more efficient than using the strcoll() collation function because the string is transformed based on the locale tables only once. However, the transformation function must convert all characters in the string for each level of a multi-level colla- tion. In comparison, the collation function stops comparing characters at the first inequality. These efficiency tradeoffs make the most efficient method for a specific application dependent on both the number of repeated comparisons for each string and the contents of each string. RETURN VALUES
Upon successful completion, the strxfrm() function returns the number of bytes required to store the transformed string (not including the terminating null byte). If this is greater than or equal to the value of the n parameter, which specifies the maximum number of bytes that can be stored in s1, the contents of s1 are indeterminate. ERRORS
If the following condition occurs, the strxfrm() function sets errno to the corresponding value. The s2 parameter contains codes outside the domain of the collating sequence defined by the current locale. RELATED INFORMATION
Functions: setlocale(3), strcoll(3), string(3)/strcmp(3), wcsxfrm(3) Standards: standards(5) delim off strxfrm(3)

Check Out this Related Man Page

wcscoll(3)						     Library Functions Manual							wcscoll(3)

NAME
wcscoll - Compares wide-character strings by using collation information LIBRARY
Standard C Library (libc) SYNOPSIS
#include <wchar.h> int wcscoll( const wchar_t *wcs1, const wchar_t *wcs2); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: wcscoll(): XSH5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Points to a wide-character string. Points to a wide-character string. DESCRIPTION
The wcscoll() function compares the two wide-character strings pointed to by the wcs1 and wcs2 parameters based on the collation values specified by the LC_COLLATE category of the program's current locale. The wcscoll() function may be unsuccessful if the wide-character strings specified by the wcs1 or wcs2 parameters contain characters out- side the domain of the current collating sequence. NOTES
The wcscoll() function differs from the wcscmp() function in that the former compares wide characters based on locale-dependent collating order, while the latter compares wide characters based on machine collating order. The wcscoll() function is more expensive in terms of time than the wcscmp() function because of the overhead of obtaining the collation values from the current locale. If an application does multiple comparisons based on the current locale's collation values and uses the same set of text strings, the wcsxfrm() transformation function in conjunction with the wcscmp() function may be more efficient than the wcscoll() collation function. This is because the string is transformed based on the locale tables only once. However, the transformation function must convert all characters in the string for each level of a multilevel collation. In comparison, the collation function stops comparing characters at the first inequality. These tradeoffs make the most efficient method for a specific application dependent on the number of repeated comparisons of strings within the set, the number of collation levels for the current locale, and the values of the strings within the set. RETURN VALUES
On successful completion, the wcscoll() function returns an integer whose value is greater than 0 (zero) if wcs1 is greater than wcs2, returns 0 (zero) if the strings are equivalent, and returns an integer whose value is less than 0 (zero) if wcs1 is less than wcs2. The sign of a nonzero return value is determined by the sign of the difference between the collation weights of the first pair of wide-charac- ter codes that differ in the objects being compared. The wcscoll() function indicates error conditions by setting errno; however, there is no return value to indicate an error. To check for errors, errno should be set to 0 (zero), then checked upon return from the wcscoll() function. If errno has a nonzero value, an error occurred. ERRORS
If the following condition occurs, the wcscoll() function sets errno to the corresponding value: The wide-character string pointed to by the wcs1 or wcs2 string contained characters outside of the domain of the collating sequence. RELATED INFORMATION
Functions: strcoll(3), wcscmp(3), wcsxfrm(3) Standards: standards(5) delim off wcscoll(3)
Man Page