Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Format (DOS command) details.
Format (DOS command) details.
Format is a command of DOS system, which is used to format disks. This is an advanced format that programs the format of the disk. The Format parameter is a format string used to format the value in Args.

Mbth: format category: a command property of DOS system: advanced format belongs to: general usage of formatting programming on disk, other usage, virus problem, main format of general usage: formatted volume) will return 1 2 3 1 2. If you want to return 1 2 3 1 4, it must be as follows: Format('%d %d %d %0:d %3:d 0: d% 3: d% 3: d 0: d% 3: d'), but when using it, be careful that the index cannot exceed the number in Args, otherwise it will cause format ('this is% 2:). Because there are only 12 13 numbers in Args, the index can only be 0 or 1, where 2 is the wrong [width] to specify the width of the value to be formatted. See examples to understand the format ('this is %4d', [12]); The output is: this is 12, which is relatively easy, but if the value of Width is less than the length of the parameter, it has no effect. For example: format ('This is% 1d', [12]); The output is: this is 12 ["-"], and the specified parameters are aligned to the left. When combined with [width], the best effect can be seen: format ('this is%-4d, yes', [12]); The output is: this is 12, which is [". "prec] specifies the precision, which is most suitable for floating-point numbers: format ('this is% .2f', ['1.1234]); Output this in 1. 12 format ('this is% .7f', ['1.1234]); Lost this is 1. 1234000, but for integers, if the number of digits of prec, such as integer, is small, it will have no influence; on the contrary, if it is larger than the number of digits of integer, it will be preceded by 0(' this is%. 7d', [1234]); The output is: this is 000 1234] For character type, it is just the opposite of integer value. If the prec is greater than the string length, it has no effect; Otherwise, the tail character format ('this is% .2s', ['1234']) will be truncated; The output is this is 12 and the above example: Format('this is %e', [-2.22]); What is returned is: This is--2.22000000000000E+000 How to get rid of the extra 0? This will do. Format ('This is %.2e', [-2.22]); FormatDateTime function FormatDateTime (constant format: String Datetime: TDatetime): string; Overload; Of course, there is another Format-like one, except that the first Format parameter commonly used here is a formatted string. Date time is a type of time. The return value is a formatted string. The key point is that the instruction character c in the format parameter displays the time in a short time format, that is, all numbers represent FormatdateTime('c', now); The output is: the date in the time corresponding to 9: 55: 40 d on August 7, 2004. If the date is one, one will be displayed, and if it is two, two FormatdateTime('d', now) will be displayed; The output may be 1 ~ 3 1 DD with the same meaning as d, but it is always a formatted datetime ('DD', now) displayed in two digits; The output may be 0 1 ~ 3 1 DDD, and the display format is dateTime('ddd', now); The output is: Saturday dddd and ddd display the same. But the above two may be different if they are in other countries. Ddddd displays the year, month, day and format ('ddddd', now) in short time format; The output is: 2004-8-7 dddddd displays FormatdateTime('dddddd', now) in a long time format; The output is: August 7th, 2004. e/ee/eeee shows the year FormatdateTime('ee', now) and the corresponding figures; For the month format dateTime('m', now), the output is: 04(04) m/mm/mmm/mmmm; The output is: 8 FormatdateTime('mm', now); The output is 08 format datetime(“mmm ",now); Output is August FormatdateTime('mmmm', now); The output is August, which is the same as ddd/dddd. In other countries, yy/yyyy may be different from the format of datetime ("YY", now) for the year. The output is 04 FormatdateTime('yyyy', now); The output is 2004 h/hh, n/nn, s/ss, z/zzz represent hours, minutes, seconds and milliseconds respectively, and t displays the time format dateTime('t', now) in a short time format; The output is 10: 17 tt, and the time format dateTime('tt', now) is displayed in a long time format; The output is 10: 18:46 ampm. It displays the format dateTime('ttampm', now) in a long time format. The output is: 10:22:57 am. If you want to add an ordinary string to the format, you can separate those specially defined characters with double quotation marks, so that if the ordinary string contains special characters, it will not be displayed as a time format: formatdatetime ('"today is "c", now); The output is: today is August 7, 200410: 26: 58. You can also add "-"or "\" to separate the dates: Formatdatetime ("Today is YY-MM-DD, now); FormatdateTime ("today" is "yy\mm\dd", now); The output is: today is 04-08-07 You can also use ":"to separate the time format datetime ("Today" is "HH: NN: SS", now); The output is: Today is 10: 32: 23 format floating-point common statement: function format floating-point (const format: stringValue: Extended): string; Overload; As mentioned above, the format parameter is a formatting instruction character and the value is an extended type. Why this type? Because it has the largest range among all floating-point values. If you pass a parameter to this method, such as Double or others, it can be saved within the scope. The key is to look at the usage of format parameter 0, an instruction to specify the corresponding number of digits. For example: FormatFloat('000.000', 22.22); The output is 022.220. Note that if the number of zeros in the integer part is less than the integer number in the Value parameter, it has no effect, for example: FormatFloat('0.00', 22.22); The output is: 22.22, but if the decimal part of 0 is less than the multiple of the decimal in the value, the corresponding decimal and digits will be truncated, such as: FormatFloat('0.0', 22.22); The output is: 22.2 You can also specify a comma in the integer 0, and the integer must be greater than 3, so there will be a comma format float ('0,000.0', 2222.22); The output is: 2,222.2 If yes, Format Float ('000,0.0', 2222.22); Its output is still: 2222.2. Notice its regularity. The usage of # and 0 is the same. So far, I haven't found any difference. FormatFloat('##。 ##',22.22); The output is: 22.00 E scientific representation, FormatFloat('0.00E+00', 2222.22), just look at a few examples; Output is 2.22 e+03 floating point ('0000.00e+00', 2222.22); The output is 2222.22 e+00 floating point ('00.0e+0', 2222.22); 22.2E+2 understands that the 0 to the right of E is dominant. Can this command format really completely eliminate viruses? Some people say that this command format can completely eliminate viruses. A: The general hard disk can be roughly divided into three areas * hard disk partition area * hard disk boot area * file data area. However, the command in Dos format can only erase the "file data area" in the hard disk, and the general boot virus can still infect the hard disk partition and boot sector (MBR and boot sector), and then other abnormal or destructive behaviors occur. Once you find that the computer virus has established a poison nest in your computer, and the "drug Lord" is very cunning and good at hiding, and you decide to die with it, please take the following steps: * Turn off the computer power (shut down) * Restart it with the clean and nontoxic original Dos startup disk * A:& gt;; ; Then type a: > Fdisk /mbr key * and then type a: > Sys c: * and then type a: > Format c: basically, there will be no computer virus after the above actions are completed. However, it should be noted that your information will disappear. If you want to keep the data you have worked so hard to build, the most fundamental way is to let a set of antivirus software that can monitor the background give you medicine.