コード例 #1
0
 public virtual void print(StreamWriter output, SupportClass.TextNumberFormat format, int width)
 {
     output.WriteLine();
     for (int i = 0; i < this.m; i++)
     {
         for (int j = 0; j < this.n; j++)
         {
             string text = format.FormatDouble(this.A[i][j]);
             int    num  = Math.Max(1, width - text.Length);
             for (int k = 0; k < num; k++)
             {
                 output.Write(' ');
             }
             output.Write(text);
         }
         output.WriteLine();
     }
     output.WriteLine();
 }
コード例 #2
0
ファイル: MDLWriter.cs プロジェクト: carlhuth/GenXSource
        /// <summary> Formats a float to fit into the connectiontable and changes it
        /// to a String.
        ///
        /// </summary>
        /// <param name="fl"> The float to be formated
        /// </param>
        /// <returns>      The String to be written into the connectiontable
        /// </returns>
        private System.String formatMDLFloat(float fl)
        {
            System.String s = "", fs = "";
            int           l;

            SupportClass.TextNumberFormat nf = SupportClass.TextNumberFormat.getTextNumberInstance(new System.Globalization.CultureInfo("en"));
            nf.setMinimumIntegerDigits(1);
            nf.setMaximumIntegerDigits(4);
            nf.setMinimumFractionDigits(4);
            nf.setMaximumFractionDigits(4);
            nf.GroupingUsed = false;
            s = nf.FormatDouble(fl);
            l = 10 - s.Length;
            for (int f = 0; f < l; f++)
            {
                fs += " ";
            }
            fs += s;
            return(fs);
        }