Difference between revisions of "TOSTRING()"
Yvonnemilne (Talk | contribs) (→Products) |
Yvonnemilne (Talk | contribs) |
||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
==Purpose== | ==Purpose== | ||
− | Function to | + | Function to evaluate an expression and return the result as a string |
==Syntax== | ==Syntax== | ||
− | + | TOSTRING(<expr> [, <expN>]) | |
==See Also== | ==See Also== | ||
− | [[ | + | [[CAST()]], [[DTOC()]], [[DTOS()]], [[ETOS()]], [[LTOS()]], [[MTOS()]], [[SET STRICT]], [[STR()]] |
==Description== | ==Description== | ||
− | The | + | The TOSTRING() function evaluates the expression in <expr> and returns the result as a string. The <expr> can be any valid string, date, datetime, logical or numeric expression. |
+ | Where <expr> is a date or datetime expression, the string returned will conform to the current SET DATE, SET SEPARATOR, SET SECONDS and SET CENTURY settings, in the same format as DTOC() or TTOC(). | ||
− | + | The optional <expN> is used to specify the length of the string returned. If the length is shorter than that required by <expr>, strings, dates and datetimes are truncated to the right and numerics truncated to the left. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ==Example== | |
+ | <code lang="recital"> | ||
+ | ? tostring({03/29/2003}) | ||
+ | 03/29/2003 | ||
+ | ? tostring({03/29/2003},5) | ||
+ | 03/29 | ||
− | + | ? tostring(10 * 10) | |
+ | 100 | ||
+ | ? tostring(0.45,3) | ||
+ | .45 | ||
+ | ? tostring("Hello" + " " + "World") | ||
+ | Hello World | ||
+ | ? tostring("Hello" + " " + "World",5) | ||
+ | Hello | ||
− | + | ? tostring(.F.) | |
− | + | F | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
</code> | </code> | ||
Line 54: | Line 45: | ||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
− | [[Category: | + | [[Category:Expressions and Type Conversion]] |
− | [[Category: | + | [[Category:Expressions and Type Conversion Functions]] |
Revision as of 14:48, 6 November 2009
Purpose
Function to evaluate an expression and return the result as a string
Syntax
TOSTRING(<expr> [, <expN>])
See Also
CAST(), DTOC(), DTOS(), ETOS(), LTOS(), MTOS(), SET STRICT, STR()
Description
The TOSTRING() function evaluates the expression in <expr> and returns the result as a string. The <expr> can be any valid string, date, datetime, logical or numeric expression.
Where <expr> is a date or datetime expression, the string returned will conform to the current SET DATE, SET SEPARATOR, SET SECONDS and SET CENTURY settings, in the same format as DTOC() or TTOC().
The optional <expN> is used to specify the length of the string returned. If the length is shorter than that required by <expr>, strings, dates and datetimes are truncated to the right and numerics truncated to the left.
Example
? tostring({03/29/2003}) 03/29/2003 ? tostring({03/29/2003},5) 03/29 ? tostring(10 * 10) 100 ? tostring(0.45,3) .45 ? tostring("Hello" + " " + "World") Hello World ? tostring("Hello" + " " + "World",5) Hello ? tostring(.F.) F
Products
Recital, Recital Server