コード例 #1
0
ファイル: MDLWriter.cs プロジェクト: carlhuth/GenXSource
 /// <summary> Formats an int to fit into the connectiontable and changes it
 /// to a String.
 ///
 /// </summary>
 /// <param name="i"> The int to be formated
 /// </param>
 /// <param name="l"> Length of the String
 /// </param>
 /// <returns>     The String to be written into the connectiontable
 /// </returns>
 private System.String formatMDLInt(int i, int l)
 {
     System.String s = "", fs = "";
     SupportClass.TextNumberFormat nf = SupportClass.TextNumberFormat.getTextNumberInstance(new System.Globalization.CultureInfo("en"));
     //UPGRADE_ISSUE: Method 'java.text.NumberFormat.setParseIntegerOnly' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javatextNumberFormatsetParseIntegerOnly_boolean'"
     //nf.setParseIntegerOnly(true);
     nf.setMinimumIntegerDigits(1);
     nf.setMaximumIntegerDigits(l);
     nf.GroupingUsed = false;
     s = nf.FormatLong(i);
     l = l - s.Length;
     for (int f = 0; f < l; f++)
     {
         fs += " ";
     }
     fs += s;
     return(fs);
 }
コード例 #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);
        }