/*** Book: Thinking in Java * Features: Formatting parameters for the Java string format specifier * format string syntax as follows: *%[argument_index$][flags][width][.precision] conversion* file: receipt.java* time: April 11, 2015 19:40:53* Author:
{0: yy-mm-dd hh: mm}
By using customDatetimeFormat description to create your own customDatetimeFormat String, you can better control the formatting
. Combine one or more custom format specifiers to constructDatetimeFormat mode. In fact, most
Replace each format item in the specified string with the text equivalent item of the value of the corresponding object.
String Str1 = string. Format ("{0: N1}", 56789 ); // Result: 56,789.0 String Str2 = string. Format ("{0: N2}", 56789 ); //
"Turn" http://blog.csdn.net/samsone/article/details/75567811. Formatted currency (related to system environment, Chinese system default format RMB, English system format USD)String. Format ("{0:c}", 0.2) results are: ¥0.20 (English operating system
1. Formatted currency (related to system environment, Chinese system default format RMB, English system format USD)String. Format ("{0:c}", 0.2) results are: ¥0.20 (English operating system results: $0.20)The default formatting retains two decimal
1. Use {0 :?} Format
You can use the string. Format method or the console. Write method to format numeric results. The latter method calls string. format. Use a format string to specify the format. The following table contains supported standard
I recently encountered some format conversion problems during encryption and decryption. I pasted the msdn example. For details:
Http://msdn.microsoft.com/zh-cn/library/y11056e9 (V = vs.100). aspx
There are other related information. Mark it and
Http://msdn.microsoft.com/library/dotnet/cpguide/cpconstandardnumericformatstrings.htm (This is the connection URL)
Standard Numeric Format Strings are used to return commonly used Numeric string types. They take the "form X0, where X is" the format
Integer
LL stands for long
% #0 and % # x can print the octal and hexadecimal prefixes.
Short
Int
Long
Long
Unsigned
Octal
% Ho
% O
% Lo
% LLo
Decimal
% Hu
% U
% Lu
%
I. Definition
String. Format Is to replace each format item in the specified string type data with the text equivalent item of the corresponding object value.
For example:
(1)
String p1 = "Jackie ";
String P2 = "aillo ";
Response.
Learning content: C #; Learning books: Illustrated Tutorials (Chinese fourth edition).Table of Contents: Chapter II Programming Overview of C #-----> 2.7 outputting text from programs-----> 2.7.5 Formatting numeric
C # Format String. Format
This is often used to format strings of dates and numbers, so we sorted out some of the help items here.
The following table describes the standard format specifiers used to format datetime objects.Format descriptionD.
This is often used to format strings of dates and numbers, so we sorted out some of the help items here.
The following table describes the standard format specifiers used to format DateTime objects.Format descriptionD. The short date mode displays
This is often used to format strings of dates and numbers, so we sorted out some of the help items here.
The following table describes the standard format specifiers used to format DateTime objects.Format descriptionD. The short date mode displays
This is often used to format strings of dates and numbers, so we sorted out some of the help items here.The following table describes the formats used for formatting.DateTimeStandard Format of the object.
Format descriptionNameDescription
DShort
1. Formatted currency (related to system environment, Chinese system default format RMB, English system format USD)String. Format ("{0:c}", 0.2) results are: ¥0.20 (English operating system results: $0.20)The default formatting retains two decimal
Format description
Name
Description
D
Short date mode
Displays
The pattern defined by the datetimeformatinfo. shortdatepattern attribute or the pattern defined by the provider in the specified format.
D
Long date
Turn http://kwon.iteye.com/blog/1068255 http://blog.csdn.net/tvvbbb/article/details/47256943public static string decimaltostring (decimal D){Return d.tostring ("#0. ######");}This display is very simple to a few examples to understand, notice the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.