Αποτελέσματα Αναζήτησης
27 Μαρ 2019 · If you're just formatting a number, you can just provide the proper custom numeric format to make it a 3 digit string directly: myString = 3.ToString("000"); Or, alternatively, use the standard D format string: myString = 3.ToString("D3");
12 Οκτ 2015 · If the first object in the array is a String, and depending on the number of objects in the * array, then a very simplified and simple-minded C#-style formatting is done. Format items * "{0}", "{1}", etc., are replaced by the corresponding following object, converted to string * (of course).
15 Μαΐ 2012 · You can use Int32.ToString("000") to format an integer in this manner. For details, see Custom Numeric Format Strings and Int32.ToString: string one = a.ToString("000"); // 001 string two = b.ToString("000"); // 010
Converts the value of objects to strings based on the formats specified and inserts them into another string. If you are new to the String.Format method, see Get started with the String.Format method for a quick overview.
4 Οκτ 2022 · Learn about parsing numeric strings in .NET. Learn how to parse with format providers, NumberStyles enumeration values, and Unicode digits.
The Format () method returns a formatted string based on the argument passed. In this tutorial, we will learn about the C# String.Format () method with the help of examples.
9 Αυγ 2024 · The String#format method is very useful for formatting numbers. The method takes two arguments. The first argument describes the pattern of how many decimals places we want to see, and the second argument is the given value: double value = 4.2352989244d; assertThat(String.format("%.2f", value)).isEqualTo("4.24");