Difference between revisions of "TOSTRING()"

From Recital Documentation Wiki
Jump to: navigation, search
Line 8: Line 8:
  
 
==See Also==
 
==See Also==
[[CAST()]], [[DTOC()]], [[DTOS()]], [[ETOS()]], [[LTOS()]], [[MTOS()]], [[SET STRICT]], [[STR()]]
+
[[CAST()]], [[DTOC()]], [[DTOS()]], [[ETOS()]], [[LTOS()]], [[MTOS()]], [[RTOS()]], [[SET STRICT]], [[STR()]]
  
  

Revision as of 16:10, 17 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(), RTOS(), 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