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( )); }
private void BTN_NumberForm_Click(object sender, EventArgs e) { var numberForm = new NumberForm("请输入一个数字", "", 3, false, true, false, true); numberForm.ShowDialog(); }
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); }
public override void SpellOut(MyStringBuilder sb, uint numberЕдиниц, NumberForm род) { sb.Append(SpellOutНаДцать[numberЕдиниц]); }
public override void SpellOut(MyStringBuilder sb, uint numberЕдиниц, NumberForm род) { sb.Append(this.названиеДесятка); if (numberЕдиниц == 0) { // После "двадцать", "тридцать" и т.д. не пишут "ноль" (единиц) } else { sb.Append(SpellOutЦифры(numberЕдиниц, род)); } }
public abstract void SpellOut(MyStringBuilder sb, uint numberЕдиниц, NumberForm род);
public override void SpellOut(MyStringBuilder sb, uint numberЕдиниц, NumberForm род) { sb.Append(SpellOutЦифры(numberЕдиниц, род)); }
public override string SpellOut(NumberForm род) { return this.spellOut; }
public override string SpellOut(NumberForm form) { return form.GetForm(this); }
public abstract string SpellOut(NumberForm род);
private static string SpellOutЦифры(uint цифра, NumberForm род) { return Цифры[цифра].SpellOut(род); }
/// <summary> </summary> public MeasureUnit(NumberForm numberForm, string именЕдин, string родЕдин, string родМнож) { this.numberForm = numberForm; this._nominativeSingle = именЕдин; this._genitiveSingle = родЕдин; this._genitivePlural = родМнож; }