U_CFUNC int32_t removeCmtText(UChar* source, int32_t srcLen, UErrorCode* status){ srcLen = trim(source, srcLen, status); UnicodeString patString("^\\s*?\\*\\s*?"); // remove pattern like " * " at the begining of the line srcLen = removeText(source, srcLen, patString, UREGEX_MULTILINE, UnicodeString(), status); return removeText(source, srcLen, UnicodeString("[ \\r\\n]+"), 0, UnicodeString(" "), status);// remove new lines; }
U_CAPI URegularExpression * U_EXPORT2 uregex_openC( const char *pattern, uint32_t flags, UParseError *pe, UErrorCode *status) { if (U_FAILURE(*status)) { return NULL; } if (pattern == NULL) { *status = U_ILLEGAL_ARGUMENT_ERROR; return NULL; } UnicodeString patString(pattern); return uregex_open(patString.getBuffer(), patString.length(), flags, pe, status); }
U_CAPI UMessageFormat* U_EXPORT2 umsg_open( const UChar *pattern, int32_t patternLength, const char *locale, UParseError *parseError, UErrorCode *status) { //check arguments if(status==NULL || U_FAILURE(*status)) { return 0; } if(pattern==NULL||patternLength<-1){ *status=U_ILLEGAL_ARGUMENT_ERROR; return 0; } UParseError tErr; if(parseError==NULL) { parseError = &tErr; } UMessageFormat* retVal = 0; int32_t len = (patternLength == -1 ? u_strlen(pattern) : patternLength); UnicodeString patString((patternLength == -1 ? TRUE:FALSE), pattern,len); retVal = (UMessageFormat*) new MessageFormat(patString,Locale(locale),*parseError,*status); if(retVal == 0) { *status = U_MEMORY_ALLOCATION_ERROR; return 0; } return retVal; }
U_CAPI UMessageFormat* U_EXPORT2 umsg_open( const UChar *pattern, int32_t patternLength, const char *locale, UParseError *parseError, UErrorCode *status) { //check arguments if(status==NULL || U_FAILURE(*status)) { return 0; } if(pattern==NULL||patternLength<-1){ *status=U_ILLEGAL_ARGUMENT_ERROR; return 0; } UParseError tErr; if(parseError==NULL) { parseError = &tErr; } int32_t len = (patternLength == -1 ? u_strlen(pattern) : patternLength); UnicodeString patString(patternLength == -1, pattern, len); MessageFormat* retVal = new MessageFormat(patString,Locale(locale),*parseError,*status); if(retVal == NULL) { *status = U_MEMORY_ALLOCATION_ERROR; return NULL; } if (U_SUCCESS(*status) && MessageFormatAdapter::hasArgTypeConflicts(*retVal)) { *status = U_ARGUMENT_TYPE_MISMATCH; } return (UMessageFormat*)retVal; }