Esempio n. 1
0
        public static void ArgumentHasCorrectStringRepresentation(int?index, int alignment, string format, int startOffset, int endOffset, NumberForm numberForm, PluralForm availablePluralForms, PluralForm?pluralRangeForm, string expectedString)
        {
            var argumentHole = index.HasValue ? new FormatString.ArgumentHole(index.Value, alignment, format, startOffset, endOffset) : null;
            var argument     = new FormatString.Argument(argumentHole, numberForm, availablePluralForms, pluralRangeForm);

            Assert.Equal(expectedString, argument.ToString( ));
        }
Esempio n. 2
0
        private void BTN_NumberForm_Click(object sender, EventArgs e)
        {
            var numberForm = new NumberForm("请输入一个数字", "", 3, false, true, false, true);

            numberForm.ShowDialog();
        }
Esempio n. 3
0
        protected bool TryExtractPluralForm(ref string name, out PluralForm pluralForm, out NumberForm numberForm)
        {
            pluralForm = PluralForm.Other;
            numberForm = NumberForm.Cardinal;

            var match = (string)null;

            if (Match(name, zero, comparison))
            {
                match = zero;    pluralForm = PluralForm.Zero;
            }
            else if (Match(name, one, comparison))
            {
                match = one;     pluralForm = PluralForm.One;
            }
            else if (Match(name, two, comparison))
            {
                match = two;     pluralForm = PluralForm.Two;
            }
            else if (Match(name, few, comparison))
            {
                match = few;     pluralForm = PluralForm.Few;
            }
            else if (Match(name, many, comparison))
            {
                match = many;    pluralForm = PluralForm.Many;
            }
            else if (Match(name, other, comparison))
            {
                match = other;   pluralForm = PluralForm.Other;
            }
            else if (Match(name, explicitZero, comparison))
            {
                match = other;   pluralForm = PluralForm.ExplicitZero;
            }
            else if (Match(name, explicitOne, comparison))
            {
                match = other;   pluralForm = PluralForm.ExplicitOne;
            }
            else if (Match(name, discard, comparison))
            {
                match = discard; pluralForm = PluralForm.Other;
            }
            else
            {
                if (Match(name, ordinalZero, comparison))
                {
                    match = ordinalZero;  pluralForm = PluralForm.Zero;
                }
                else if (Match(name, ordinalOne, comparison))
                {
                    match = ordinalOne;   pluralForm = PluralForm.One;
                }
                else if (Match(name, ordinalTwo, comparison))
                {
                    match = ordinalTwo;   pluralForm = PluralForm.Two;
                }
                else if (Match(name, ordinalFew, comparison))
                {
                    match = ordinalFew;   pluralForm = PluralForm.Few;
                }
                else if (Match(name, ordinalMany, comparison))
                {
                    match = ordinalMany;  pluralForm = PluralForm.Many;
                }
                else if (Match(name, ordinalOther, comparison))
                {
                    match = ordinalOther; pluralForm = PluralForm.Other;
                }

                if (match != null)
                {
                    numberForm = NumberForm.Ordinal;
                }
            }

            if (match == null)
            {
                return(false);
            }

            name = Trim(name, match);

            return(true);
        }
Esempio n. 4
0
				public override void SpellOut(MyStringBuilder sb, uint numberЕдиниц, NumberForm род)
				{
					sb.Append(SpellOutНаДцать[numberЕдиниц]);
				}
Esempio n. 5
0
				public override void SpellOut(MyStringBuilder sb, uint numberЕдиниц, NumberForm род)
				{
					sb.Append(this.названиеДесятка);


					if (numberЕдиниц == 0)
					{
						// После "двадцать", "тридцать" и т.д. не пишут "ноль" (единиц)
					}
					else
					{
						sb.Append(SpellOutЦифры(numberЕдиниц, род));
					}
				}
Esempio n. 6
0
				public abstract void SpellOut(MyStringBuilder sb, uint numberЕдиниц, NumberForm род);
Esempio n. 7
0
				public override void SpellOut(MyStringBuilder sb, uint numberЕдиниц, NumberForm род)
				{
					sb.Append(SpellOutЦифры(numberЕдиниц, род));
				}
Esempio n. 8
0
				public override string SpellOut(NumberForm род)
				{
					return this.spellOut;
				}
Esempio n. 9
0
				public override string SpellOut(NumberForm form)
				{
					return form.GetForm(this);
				}
Esempio n. 10
0
				public abstract string SpellOut(NumberForm род);
Esempio n. 11
0
			private static string SpellOutЦифры(uint цифра, NumberForm род)
			{
				return Цифры[цифра].SpellOut(род);
			}
Esempio n. 12
0
			/// <summary> </summary>
			public MeasureUnit(NumberForm numberForm, string именЕдин, string родЕдин, string родМнож)
			{
				this.numberForm = numberForm;

				this._nominativeSingle = именЕдин;

				this._genitiveSingle = родЕдин;

				this._genitivePlural = родМнож;
			}