Exemple #1
0
        /// <summary>
        /// Retrieves a delimiter string from the locale data.
        /// </summary>
        ///
        /// <param name="type">The type of delimiter string desired. Currently, the validchoices are QUOTATION_START, QUOTATION_END,ALT_QUOTATION_START, or ALT_QUOTATION_END.</param>
        /// <returns>The desired delimiter string.</returns>
        /// @stable ICU 3.4
        public String GetDelimiter(int type)
        {
            String[] delimiterTypes = { "quotationStart",          "quotationEnd",
                                        "alternateQuotationStart", "alternateQuotationEnd" };

            ICUResourceBundle stringBundle = (ICUResourceBundle)bundle.Get(
                "delimiters").Get(delimiterTypes[type]);

            if (noSubstitute &&
                (stringBundle.GetLoadingStatus() == IBM.ICU.Impl.ICUResourceBundle.FROM_ROOT))
            {
                return(null);
            }

            return(stringBundle.GetString());
        }
Exemple #2
0
        /// <summary>
        /// Returns the set of exemplar characters for a locale.
        /// </summary>
        ///
        /// <param name="options">Bitmask for options to apply to the exemplar pattern. Specifyzero to retrieve the exemplar set as it is defined in thelocale data. Specify UnicodeSet.CASE to retrieve a case-foldedexemplar set. See <see cref="null"/>for a complete list of valid options. The IGNORE_SPACE bit isalways set, regardless of the value of 'options'.</param>
        /// <param name="extype">The type of exemplar set to be retrieved, ES_STANDARD orES_AUXILIARY</param>
        /// <returns>The set of exemplar characters for the given locale.</returns>
        /// @stable ICU 3.4
        public UnicodeSet GetExemplarSet(int options, int extype)
        {
            String[] exemplarSetTypes = { "ExemplarCharacters",
                                          "AuxExemplarCharacters" };
            try {
                ICUResourceBundle stringBundle = (ICUResourceBundle)bundle
                                                 .Get(exemplarSetTypes[extype]);

                if (noSubstitute &&
                    (stringBundle.GetLoadingStatus() == IBM.ICU.Impl.ICUResourceBundle.FROM_ROOT))
                {
                    return(null);
                }

                return(new UnicodeSet(stringBundle.GetString(),
                                      IBM.ICU.Text.UnicodeSet.IGNORE_SPACE | options));
            } catch (MissingManifestResourceException ex) {
                if (extype == LocaleData.ES_AUXILIARY)
                {
                    return(new UnicodeSet());
                }
                throw ex;
            }
        }