![]() Note that width value precedes the precision value ShowMessage( Format('0 padded decimal = ', )) The precision value forces 0 padding to the desired size ShowMessage( Format('Justified decimal = ', )) With the '-' operator, the data is left justified ShowMessage( Format('Padded decimal = ', )) Note the characters are added to show formatting The width value dictates the output size ShowMessage( Format('Hexadecimal = %x', )) Įxample code : Using the index, width and precision values ShowMessage( Format('Unsigned decimal = %u', )) The character used to display the thousands separatorĭownload this web site as a Windows program.Įxample code : Showing all of the formatting data types Rich formatting of a floating point number into a stringĭefines negative amount formatting in currency displays Rich formatting of a TDateTime variable into a string Rich formatting of a currency value into a string The character used to display the decimal pointĬonvert a floating point value to a string with formatting The currency string used in currency display functionsĬonvert a currency value to a string with formatting See the more specific versions of data display commands, such as CurrToStrF for details.ĭefines decimal digit count in the Format functionĭefines currency string placement in curr display functions Various formatting options, such as DecimalSeparator and CurrencyString are used for some of these formatting options. It takes a local copy of global formatting variables that make the routine thread safe. You furnish the FormatSettings record before invoking the call. Version 2 of this function is for use within threads. characters are literals, the first 2 of which are used to identify two of the optional arguments. Where the square brackets refer to optional parameters, and the. The general format of each formatting substring is as follows: In simple terms, each data formatting substring starts with a % and ends with a data type indicator : This formatting is best explained by the example code. The Formatting string can comprise a mix of ordinary characters (that are passed unchanged to the result string), and data formatting characters. The Formatting parameter defines how the Data array is manipulated into the returned string. It provides very precise control over this formatting. The Format function provides 'C' like formatting of multiple of simple data types into a string. Rich formatting of numbers and text into a stringĬonst Formatting : string Const Data : array of constĬonst Formatting : string Const Data : array of const FormatSettings : TFormatSettings The character used to separate display time fieldsĭownload this web site as a Windows program.Delphi Basics : Format command Delphi Basics Long version of the time to string formatĬompact version of the date to string formatĬonverts a date string into a TDateTime valueĬonverts a time string into a TDateTime valueĭetermines AM value in DateTimeToString procedureĭetermines PM value in DateTimeToString procedure The character used to separate display date fieldsĬonverts TDateTime date and time values to a string If the year is 2 digits, the century is determined by the TwoDigitYearCenturyWindow value.Īny errors in the date/time string will yield EConvertError. Note that year 0015, for example, must be given with the century digits 15 on its own would be seen as a recent year. Omitting the year results in the use of the current year. The second, time part, separated by a blank from the date must adhere to the format of the LongTimeFormat value, and use the TimeSeparator character to separate the hour, minute and second values.ĭay/month/year hour:minute:second.msec, where : ![]() The first, date part of the string must adhere to the format of the ShortDateFormat value, and use the DateSeparator character to separate the day, month and year values. The StrToDateTime function attempts to convert a date plus time as a string DateTime into a TDateTime value. Delphi Basics : StrToDateTime command Delphi BasicsĬonverts a date+time string into a TDateTime valueĬonst DateTime : string const FormatSettings : TFormatSettings
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |