CStr
Returns a string representation of the value.
Usage:
CStr( x )
CStr( x, y )
CStr( x, y, z )
CStr( x, y, z, w )
CStr( x, y, z, w, q )
Parameters:
Converting a Boolean
| x |
a Boolean value that is converted to a string (either "true" or "false") |
Converting a Number or Currency
| x |
a number or currency value to be converted (can be a whole number or a decimal number) |
| y |
a number specifying how many decimal places of x to include in the string [OPTIONAL, default is 2] |
| z |
the character to separate thousands with [OPTIONAL, default depends on your locale] |
| w |
the character to use for the decimal point [OPTIONAL, default depends on your local] |
| x |
a number or currency value to be converted (can be a whole number or a decimal number) |
| y |
the text string specifying how to format the string representation (see formatting patterns) |
| z |
How many decimal places of x to include in the string [OPTIONAL, default is 2] |
| w |
the character to separate thousands with [OPTIONAL, default depends on your locale] |
| q |
the character to use for the decimal point [OPTIONAL, default depends on your locale] |
Converting Date, Time, or DateTime Values
| x |
a date, time, or datetime to convert to a string |
| y |
the text string specifying how to format the string representation (see formatting patterns) [OPTIONAL, default depends on your locale] |
| z |
the text string to use for "A.M." (see formatting patterns) [OPTIONAL, default depends on your locale - only for time and datetime] |
| w |
the text string to use for "P.M." (see formatting patterns) [OPTIONAL, default depends on your locale - only for time and datetime] |
Examples:
The following examples assume you have an English (U.S.) locale - it may look different in your locale:
CStr(976.4441) // Returns "976.44"
CStr((1=1)) // Returns "True"
CStr(976.4441,3) // Returns "976.444"
CStr(1234567.987,1,"*","?") // Returns "1*234*568?0"
CStr(CDate(1981, 4, 15), "MMM dd, YYYY, dddd") // Returns "April 15, 1981, Wednesday"