UniTransformStr

UniTransformStr transforms strings according to a XformObject created by UniCreateTransformObject.

Syntax
int UniTransformStr (XformObject xform_object, const UniChar *InpBuf, int *InpSize, UniChar *OutBuf, int *OutSize)

Parameters

 * xform_object (XformObject) : An xform_object created by UniCreateTransformObject.
 * InpBuf (const UniChar *) : String to be transformed.
 * InpSize (int *) : Number of code elements in InpBuf.
 * OutBuf (UniChar *) : Target string.
 * OutSize (int *) : Number of code elements that OutBuf can hold.

Returns
return value (int)  -  returns

UniTransformStr returns one of the following:


 * ULS_SUCCESS : Transformation completed without errors.
 * ULS_UNSUPPORTED : The transform object was not found.

Remarks
UniTransformStr transforms a UniChar character string as specified by the transformation object handle xform_object for the LC_CTYPE category. This category applies to the locale object that was used to create the transformation handle xform_object (by UniCreateTransformObject). The text from the input buffer is transformed and the result is placed in the output buffer. Any characters not included in the transformation type referenced by xform_object are moved, to the output buffer, unchanged.

The InpSize argument, on input, specifies the number of code elements to be transformed. A value of -1 indicates that the input is delimited by a UniChar NULL character (0x0000). On return, the value is modified to the actual number of code elements processed in the source string.

The OutSize argument, on input, specifies the size of the output buffer (number of code elements). On return, the value is modified to the actual number of code elements placed in OutBuf.

Example
This example shows how to create and use a transform object. 
 * 1) include 

int main(void) { LocaleObject locale_object = NULL;
 * 1) include 

XformObject xform_object = NULL; int         rc = ULS_SUCCESS; int         in_unistr_elem = 0; int         out_unistr_elem = 10; UniChar     *pin_unistr = (UniChar *)L"os2"; UniChar     out_unistr[10]; /*****************************************************************/        /* Assumes LANG environment variable set to a valid locale name, */ /* such as fr_FR                                                */ /*****************************************************************/        rc = UniCreateLocaleObject(UNI_UCS_STRING_POINTER,                                   (UniChar *)L"", &locale_object); if (rc != ULS_SUCCESS) { printf("UniCreateLocaleObject error: return code = %u\n", rc); return 1; }        /* Create an upper case transform object */ rc = UniCreateTransformObject(locale_object,                                     (UniChar *)L"upper", &xform_object); if (rc != ULS_SUCCESS) { printf("UniCreateTransformObject error: return code = %u\n", rc); return 1; }        /* Calculate the number of elements to transform */ in_unistr_elem = UniStrlen (pin_unistr) + 1; /* Make call to transform input string to uppercase */ rc = UniTransformStr(xform_object, pin_unistr,                            &in_unistr_elem, out_unistr,                             &out_unistr_elem); if (rc != ULS_SUCCESS) { printf("UniTransformStr error: return code = %u\n", rc); return 1; }        return ULS_SUCCESS;

} 

Format

 * 1) include 

int UniTransformStr (XformObject xform_object, const UniChar *InpBuf, int *InpSize, UniChar *OutBuf, int *OutSize) 

Related Functions

 * UniCreateTransformObject
 * UniFreeTransformObject