public XslNumberFormatter(string format, string lang, string letterValue, char groupingSeparator, int groupingSize)
            {
                // We dont do any i18n now, so we ignore lang and letterValue.
                if (format == null || format == "")
                {
                    fmtList.Add(FormatItem.GetItem(null, "1", groupingSeparator, groupingSize));
                }
                else
                {
                    NumberFormatterScanner s = new NumberFormatterScanner(format);

                    string itm;
                    string sep = ".";

                    firstSep = s.Advance(false);
                    itm      = s.Advance(true);

                    if (itm == null) // Only separator is specified
                    {
                        sep      = firstSep;
                        firstSep = null;
                        fmtList.Add(FormatItem.GetItem(sep, "1", groupingSeparator, groupingSize));
                    }
                    else
                    {
                        // The first format item.
                        fmtList.Add(FormatItem.GetItem(".", itm, groupingSeparator, groupingSize));
                        do
                        {
                            sep = s.Advance(false);
                            itm = s.Advance(true);
                            if (itm == null)
                            {
                                lastSep = sep;
                                break;
                            }
                            fmtList.Add(FormatItem.GetItem(sep, itm, groupingSeparator, groupingSize));
                        }while (itm != null);
                    }
                }
            }
Esempio n. 2
0
			public XslNumberFormatter (string format, string lang, string letterValue, char groupingSeparator, int groupingSize)
			{
				// We dont do any i18n now, so we ignore lang and letterValue.
				if (format == null || format == "")
					fmtList.Add (FormatItem.GetItem (null, "1", groupingSeparator, groupingSize));
				else {
					NumberFormatterScanner s = new NumberFormatterScanner (format);
					
					string itm;
					string sep = ".";
					
					firstSep = s.Advance (false);
					itm = s.Advance (true);
					
					if (itm == null) { // Only separator is specified
						sep = firstSep;
						firstSep = null;
						fmtList.Add (FormatItem.GetItem (sep, "1", groupingSeparator, groupingSize));
					} else {
						// The first format item.
						fmtList.Add (FormatItem.GetItem (".", itm, groupingSeparator, groupingSize));
						do {
							sep = s.Advance (false);
							itm = s.Advance (true);
							if (itm == null) {
								lastSep = sep;
								break;
							}
							fmtList.Add (FormatItem.GetItem (sep, itm, groupingSeparator, groupingSize));
						} while (itm != null);
					}
				}
			}