string PowerHome formula function
Description
Formats data as a string according to a specified display format mask. You can convert and format date, DateTime, numeric, and time data. You can also apply a display format to a string.
Syntax
string ( data {, format } )
Argument |
Description |
data
|
The data you want returned as a string with the specified formatting. Data can have a date, DateTime, numeric, time, or string data type
|
format (optional)
|
A string of the display masks you want to use to format the data. The masks consist of formatting information specific to the data type of data. If data is type string, format is requiredThe format string can consist of more than one mask, depending on the data type of data. Each mask is separated by a semicolon. See Usage for details on each data type
|
Return value
String. Returns data in the specified format if it succeeds and the empty string ("") if the data type of data does not match the type of display mask specified or format is not a valid mask.
Usage
For date, DateTime, numeric, and time data, the system's default format is used for the returned string if you don't specify a format. For numeric data, the default format is the [General] format.
For string data, a display format mask is required. (Otherwise, the function would have nothing to do.)
The format can consist of one or more masks:?
Formats for date, DateTime, string, and time data can include one or two masks. The first mask is the format for the data; the second mask is the format for a null value.
Formats for numeric data can have up to four masks. A format with a single mask handles both positive and negative data. If there are additional masks, the first mask is for positive values, and the additional masks are for negative, zero, and NULL values.
Unpredictable results will occur if the mask does not match the data type.