Difference between revisions of "TOSTRING()"

From Lianjapedia
Jump to: navigation, search
m (Text replace - "Recital" to "Lianja")
Line 50: Line 50:
 
[[Category:String Data Functions]]
 
[[Category:String Data Functions]]
 
[[Category:Formatting Functions]]
 
[[Category:Formatting Functions]]
 +
[[Category:Lianja VFP Extensions]]
 +
[[Category:VFP Function Extensions]]

Revision as of 07:44, 10 December 2012

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

Lianja, Lianja Server