# mco_uda_collate_get_range
RT

> Return a string value from the specified collation.

### Prototype

        MCO_RET mco_uda_collate_get_range(	/*IN*/ const mco_collate_h c,
                            /*IN*/ uint2 from,
                            /*OUT*/ mco_uda_value_t *val );

### Arguments

c | The address of an `mco_collate_t` struct containing the collation operands
from | The offset within this string value from which to extract the string value
val | The address of an `mco_uda_value_t` variable to receive the value in the `mco_collate_t` struct

### Description

> This function returns a string value from the specified collation by copying from the specified starting position from to the end of the string withing the collation. The val.len element of the value structure is then set to indicate the number of characters copied. This function is used within collation compare and hash functions.

### Return Codes

MCO_S_OK | The collation value was successfully returned

### Example

        Application snippet:

        /* custom compare & hash functions */
        int2 coll_cmp(mco_collate_h c1, uint2 len1, mco_collate_h c2, uint2 len2)
        {
            mco_uda_value_t val1, val2;
            char buf1[20], buf2[20];

            /* get first object's value */
            val1.type = MCO_DD_STRING;
            val1.v.p.size = sizeof(buf1);
            val1.v.p.p.c = buf1;
            mco_uda_collate_get_range(c1, 0, &val1);

            /* get second object's value */
            val2.type = MCO_DD_STRING;
            val2.v.p.size = sizeof(buf2);
            val2.v.p.p.c = buf2;
            mco_uda_collate_get_range(c2, 0, &val2);

            /* compare values */
            return STR_CMP(buf1, buf2);
        }

### Files

Header file:
mcouda.h
Source file:
mcouda.c
Library:
libmcouda.a