Int A = 12345678; // Output in the sring format Label1.text = string. Format ("asdfadsf {0} adsfasdf", ); Label2.text = "asdfadsf" + A. tostring () + "adsfasdf "; Label1.text = string. Format ("asdfadsf {0: c} adsfasdf", a); // asdfadsf ¥0. 1,234.00 adsfasdf Label2.text = "asdfadsf" + A. tostring ("C") + "adsfasdf"; // asdfadsf ¥0. 1,234.00 adsfasdf Double B = 1234.12543; Int A = 12345678; // Output in special string format Label1.text = string. Format ("asdfadsf {0: c} adsfasdf", B); // asdfadsf ¥0. 1,234.13 adsfasdf Label2.text = "asdfadsf" + B. tostring ("C") + "adsfasdf"; // asdfadsf ¥0. 1,234.13 adsfasdf Label1.text = string. Format ("{0: C3}", B); // ¥1,234.125 Label2.text = B. tostring ("C3"); // ¥1,234.125 Label1.text = string. Format ("{0: d}", a); // in decimal format -- 12345678 Label2.text = B. tostring ("D"); // decimal -- same type, conversion error Label1.text = string. Format ("{0: e}", a); // index -- 1.234568e + 007 Label2.text = B. tostring ("e"); // index -- 1.234125e + 003 Label1.text = string. Format ("{0: f}", a); // set the number of points -- 12345678.00 Label2.text = B. tostring ("F"); // set the number of points -- 1234.13 Label1.text = string. Format ("{0: n}", a); // value -- 12,345,678.00 Label2.text = B. tostring ("N"); // value -- 1,234.13 Label1.text = string. Format ("{0: x}", a); // hexadecimal -- bc614e Label2.text = B. tostring ("X"); // 16 -- cannot be converted with decimals, error Label1.text = string. Format ("{0: g}", a); // use the most compact mode -- 12345678 Label2.text = B. tostring ("G"); // use the most compact version -- 1234.12543 Label1.text = string. Format ("{0: R}", a); // transfer without loss of precision -- integers are not allowed and an error is returned. Label2.text = B. tostring ("R"); // transfer without loss of precision -- 1234.12543 Double B = 4321.12543; Int A = 1234; Custom mode output: // "0" Description: placeholder. If possible, fill the position Label1.text = string. Format ("{0: 00}", a); // 001234 Label2.text = string. Format ("{0: 00}", B); // 004321 // "#" Description: placeholder. If possible, fill the position. Label1.text = string. Format ("{0: ######}", a); // 1234 Label2.text = string. Format ("{0: ######}", B); // 4321 Label1.text = string. Format ("{0: #0 ####}", a); // 01234 Label2.text = string. Format ("{0: 0 #0000}", B); // 004321 // "." Description: decimal point Label1.text = string. Format ("{0: 000. 000}", a); // 1234.000 Label2.text = string. Format ("{0. 000}", B); // 4321.125 Double B = 87654321.12543; Int A = 12345678; // "," Description: Numeric grouping, also used for the Multiplier Label1.text = string. Format ("{0, 00}", a); // 12,345,678 Label2.text = string. Format ("{0, 00}", B); // 87,654, 32 Label1.text = string. Format ("{0: 0,}", a); // 12346 Label2.text = string. Format ("{0: 0,}", B); // 87654 Label1.text = string. Format ("{0: 0,}", a); // 12 Label2.text = string. Format ("{0: 0,}", B); // 88 Label1.text = string. Format ("{0: 0, ,}", a); // 0 Label2.text = string. Format ("{0: 0, ,}", B); // 0 // "%" Description: The format is percent. Label1.text = string. Format ("{0%}", a); // 1234567800% Label2.text = string. Format ("{0: # %}", B); // 8765432113% Label1.text = string. Format ("{0. 00%}", a); // 1234567800.00% Label2.text = string. Format ("{0: #. 00%}", B); // 8765432112.54% // "ABC" Description: displays the text in single quotes. Label1.text = string. Format ("{0: 'text' 0}", a); // text 12345678 Label2.text = string. Format ("{0: Text 0}", B); // text 87654321 // "\" Description: The character followed by the one to be printed, also used for the escape character \ n, etc. Label1.text = string. Format ("\" Hello! \ ""); // "Hello! " Label2.text = string. format ("[url = file: // \ c \ books \ new \ We. ASP] \ c \ books \ new \ We. ASP "); // \ c \ books \ new \ We. ASP // "@" Description: The character followed by the word to be printed, Label1.text = string. Format (@ "Hello! "); //" Hello! "Print" requires two pairs. Label2.text = string. Format (@ "\ c \ books \ new \ We. asp"); // \ c \ books \ new \ We. asp |