xHarbour Reference Documentation > Function Reference |
Converts a value to a character string.
CStr( <xValue> ) --> cString
The function returns a character string holding the converted value.
Function CStr() accepts a value of any data type and returns a character string holding information about the value. This character string can be output to the screen or printer, and is of informational use only when <xValue> is a complex data type (Array, Code block, Hash or Object).
See also: | CStrToVal(), DtoS(), HB_ValToStr(), Str(), Transform(), Valtype(), ValToPrg(), ValToPrgExp() |
Category: | Conversion functions , Debug functions , xHarbour extensions |
Source: | rtl\cstr.prg |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example demonstrates return values of function CStr() // for all data types available in xHarbour. PROCEDURE Main LOCAL aArray := { 1, 2, 3 } LOCAL bBlock := {|| Time() } LOCAL cString := "xHarbour" LOCAL dDate := Date() LOCAL hHash := { "A" => 1, "B" => 2 } LOCAL lLogic := .T. LOCAL nNumber := 1.2345 LOCAL obj := Get():new() LOCAL pPointer := ( @Main() ) LOCAL undef := NIL ? CStr( aArray ) // result: { Array of 3 Items } ? CStr( bBlock ) // result: {|| Block } ? CStr( cString ) // result: xHarbour ? CStr( dDate ) // result: 20061006 ? CStr( hHash ) // result: { Hash of 2 Items } ? CStr( lLogic ) // result: .T. ? CStr( nNumber ) // result: 1.2345 ? CStr( obj ) // result: { GET Object } ? CStr( pPointer ) // result: 4CB000 ? CStr( undef ) // result: NIL RETURN
http://www.xHarbour.com