Truncate the locale ID string to get the parent locale ID. Copies the part of the string before the last underscore. The parent locale ID will be an empty string if there is no underscore, or if there is only one underscore at localeID[0].
Definition at line 1800 of file uloc.c. References NULL, and U_FAILURE. { const char *lastUnderscore; int32_t i; if (U_FAILURE(*err)) return 0; if (localeID == NULL) localeID = uloc_getDefault(); lastUnderscore=uprv_strrchr(localeID, '_'); if(lastUnderscore!=NULL) { i=(int32_t)(lastUnderscore-localeID); } else { i=0; } if(i>0 && parent != localeID) { uprv_memcpy(parent, localeID, uprv_min(i, parentCapacity)); } return u_terminateChars(parent, parentCapacity, i, err); } |