FormatString Method

Microsoft Office InfoPath

Show All Show All

FormatString Method

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

expression.FormatString(ByVal varInput, ByVal bstrCategory As String, ByVal bstrOptions As String) As String

expression    Required. An expression that returns a reference to the Application object.

varInput Required String or XML node. The string value or XML node to be formatted.

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

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

returns    String.

Security Level

0: Can be accessed without restrictions.

Remarks

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

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

ShowList of categories

ShowList of options

Example

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

    Application.FormatString("2003-01-08", "date", "dateFormat:Long Date");