_Application3.FormatString(Object, String, String) Method

Definition

Formats the specified string or XML node according to the specified category and options parameters.

public:
 System::String ^ FormatString(System::Object ^ varInput, System::String ^ bstrCategory, System::String ^ bstrOptions);
public string FormatString (object varInput, string bstrCategory, string bstrOptions);
abstract member FormatString : obj * string * string -> string
Public Function FormatString (varInput As Object, bstrCategory As String, bstrOptions As String) As String

Parameters

varInput
Object

The value or XML node to be formatted.

bstrCategory
String

The value that specifies the category used for formatting. Values include number, percentage, currency, date, time, and datetime.

bstrOptions
String

The value that specifies the options used for formatting. Takes the form of a case-sensitive string in the format "optionName:value".

Returns

The specified string or XML node formatted according to the specified category and options parameters.

Implements

Examples

In the following example, the FormatString method of the Application object is used to format the specified date string into a long date format:

thisApplication.<span class="label">FormatString</span>("2003-01-08", "date", "dateFormat:Long Date");

Remarks

The FormatString method can be used anywhere you need to change the format of a specified string. It must be qualified with the Application name, and its return value must be assigned to a variable or used as an expression that requires a string value.

The following tables list the values that may be used for bstrCategory and bstrOptions:

List of categories

number Uses numerical values. Valid options for this category include "locale", "numDigits", "leadingZero", "grouping", "decimalSep", "thousandSep", and "negativeOrder".
percentage Uses percentage values. Valid options for this category include "locale", "numDigits", "leadingZero", "grouping", "decimalSep", "thousandSep", and "negativeOrder".
currency Uses currency values. Valid options for this category include "locale", "numDigits", "leadingZero", "grouping", "decimalSep", "thousandSep", and "negativeOrder", "positiveOrder", and "currencyLocale".
date Uses date values. Valid options for this category include "locale", "dateFormat", "useAltCalendar", and "useEnglishStringsAlways".
time Uses time values. Valid options for this category include "locale", "timeFormat", and "noSeconds".
datetime Uses datetime values. Valid options for this category include "locale", "dateFormat", "timeFormat", "noSeconds", "useAltCalendar", and "useEnglishStringAlways".

List of options

locale Specifies the locale identifier (LCID). Defaults to the current user's LCID if not specified.
numDigits Specifies the number of fractional digits after the decimal separator. The value auto may also be used to indicate that the number of decimal places that was entered will be the number of decimal places in the output. For example, 1.234, 1.234, 1.00, 1.00, 1.56e2, or 156.00. Defaults to the corresponding value in regional settings if not specified.
leadingZero Specifies whether to use leading zeros in decimal fields. Specify 0 to indicate no leading zeros and 1 to indicate leading zeros. Defaults to the corresponding value in regional settings if not specified.
grouping Specifies the size of each group of digits to the left of the decimal. Values in the range 0–9 and value 32 are valid. Value 32 indicates that the grouping is three digits, then two digits thereafter. Defaults to the corresponding value in regional settings if not specified.
decimalSep Specifies the decimal separator string. Defaults to the corresponding value in regional settings if not specified.
thousandSep Specifies the thousands separator string. Defaults to the corresponding value in regional settings if not specified.
negativeOrder Specifies the negative number mode. Defaults to the corresponding value in regional settings if not specified.
positiveOrder Specifies the positive number mode. Defaults to the corresponding value in regional settings if not specified.
currencyLocale Specifies the locale identifier (LCID) for the currency symbol. Defaults to the value specified by locale if not specified.
dateFormat Specifies a format picture string that is used to form the date string. The values "Short Date", "Long Date", "Year Month", and "none" may also be used to indicate short date format, long date format, year month format, and no format, respectively. "Short Date", "Long Date", and "Year Month" are the default formats provided by the operating system's regional and language settings.
useAltCalendar Specifies whether to use an alternate calendar for date formatting. Specify 0 to use the normal calendar and 1 to use the alternate calendar. Defaults to 0 if not specified.
useEnglishStringsAlways Specifies whether to always use English strings for date formatting. Specify 0 to use the language specified by locale and 1 to always use English. Defaults to 0 if not specified.
timeFormat Specifies a format string that is used to form the time string. The value "none" may also be used to indicate no format. Defaults to the time format in regional settings if not specified.
noSeconds Specifies whether to not use seconds. Specify 0 to use seconds and 1 to not use seconds. Defaults to 0 if not specified.

Applies to