コード例 #1
0
            // format for an array of numbers.
            public string Format(int [] values)
            {
                StringBuilder b = new StringBuilder();

                if (firstSep != null)
                {
                    b.Append(firstSep);
                }

                int formatIndex = 0;
                int formatMax   = fmtList.Count - 1;

                if (values.Length > 0)
                {
                    if (fmtList.Count > 0)
                    {
                        FormatItem itm = (FormatItem)fmtList [formatIndex];
                        itm.Format(b, values [0]);
                    }
                    if (formatIndex < formatMax)
                    {
                        formatIndex++;
                    }
                }
                for (int i = 1; i < values.Length; i++)
                {
                    FormatItem itm = (FormatItem)fmtList [formatIndex];
                    b.Append(itm.sep);
                    int v = values [i];
                    itm.Format(b, v);
                    if (formatIndex < formatMax)
                    {
                        formatIndex++;
                    }
                }

                if (lastSep != null)
                {
                    b.Append(lastSep);
                }

                return(b.ToString());
            }