From ddfb23cc4c91af7b67ab3f9e78e15a032ef19da2 Mon Sep 17 00:00:00 2001 From: Markus Scherer Date: Wed, 16 Dec 2015 05:36:59 +0000 Subject: [PATCH] ICU-12031 define StandardPlural::indexFromString(const UnicodeString &keyword, UErrorCode &errorCode) X-SVN-Rev: 38137 --- icu4c/source/i18n/standardplural.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/icu4c/source/i18n/standardplural.cpp b/icu4c/source/i18n/standardplural.cpp index 34127a42c3c..456e9390ca7 100644 --- a/icu4c/source/i18n/standardplural.cpp +++ b/icu4c/source/i18n/standardplural.cpp @@ -111,6 +111,17 @@ int32_t StandardPlural::indexFromString(const char *keyword, UErrorCode &errorCo } } +int32_t StandardPlural::indexFromString(const UnicodeString &keyword, UErrorCode &errorCode) { + if (U_FAILURE(errorCode)) { return OTHER; } + int32_t i = indexOrNegativeFromString(keyword); + if (i >= 0) { + return i; + } else { + errorCode = U_ILLEGAL_ARGUMENT_ERROR; + return OTHER; + } +} + U_NAMESPACE_END #endif // !UCONFIG_NO_FORMATTING