DevOutPict

DevOutPict

Writes a PICTURE formatted value to the current device.

Syntax

      DevOutPict( <expression>, <cPicture> [,<cColor>] ) --> NIL

Arguments

<expression> : Any valid expression to write to the device assigned by SET DEVICE command

<cPicture> : A valid PICTURE format string.

<cColor> : A valid color codes string for value to write. Default is current color setting

Returns

DevOutPict() always returns NIL

Description

DevOutPict() is a console function that outputs the value of an expression to the screen or the printer with defined PICTURE and color. Output device depens on current device.

Example

      DevOutPict( CUST->DEBIT, "99,999.99" )

Seealso

@…SAY, Col(), DevOut(), DevPos(), QOut() | QQOut(), Row(), SET DEVICE, SetPos(), Transform()

StrFormat()

StrFormat()

Format a string

Syntax

      StrFormat(<cMask>[, <cPar1>[, <cParn>[, ...]]) --> cString

Arguments

<cMask> Holds the mask for the resulting string

<cParn> Holds the strings to be inserted in the mask maximum 9 of them can be specified.

Returns

<cString> Return the mask with all the parameters inserted.

Description

String replacment, can be useful when writing international apps. You can separate the constant strings from the variable ones. Each %1 – %9 marks will be replaced with the appropriate parameter from the parameter list.

Marks can be in any order, and can be duplicated.

You can print “%” character with “%%”.

Examples

      StrFormat( "Please insert disk %1 to drive %2", hb_ntos( 2 ), "A:" )
      StrFormat( "This is %1 from %2", "Victor", "Hungary" )
      StrFormat( "%2 %1 %2", "Param1", "Param2" )

Tests

      ? StrFormat( "Please insert disk %1 to drive %2", hb_ntos( 2 ), "A:" )
      ? StrFormat( "This is %1 from %2", "Victor", "Hungary" )
      ? StrFormat( "%2 %1 %2", "Param1", "Param2" )
      ? StrFormat( "Hello" )
      ? StrFormat( "%1 - %2", "one" )
      ? StrFormat( "%1 - %2", "one", "two" )
      ? StrFormat( "%2 - %1", "one", "two" )
      ? StrFormat( "%2 - %", "one", "two" )
      ? StrFormat( "%% - %", "one", "two" )
      ? StrFormat( "%9 - %", "one", "two" )

Compliance

All platforms

Files

Library is libmisc

Seealso

Transform(), Stuff(), StrTran()

Harbour All Functions – T

TabExpand
TabPack

Tan

TanH

TBrowseDB

TBrowseNew

TFileRead

THtml

Time

TimeValid

TNortonGuide 

Token
TokenAt
TokenEnd
TokenExit
TokenInit
TokenLower
TokenNext
TokenNum
TokenSep
TokenUpper

Tone

TOs2

Transform
Trim

TRtf

TTroff

 Type

String Functions

AddASCII

AfterAtNum

AllTrim
Asc

ASCIISum

ASCPos
At

AtAdjust

AtNum
AtRepl
AtToken

BeforAtNum

Chr

CharAdd
CharAnd
CharEven
CharHist
CharList
CharMirr
CharMix
CharNoList
CharNot
CharOdd
CharOne
CharOnly
CharOr
CharPix
CharRela
CharRelRep
CharRem
CharRepl
CharRLL
CharRLR
CharSHL
CharSHR
CharSList
CharSort
CharSub
CharSwap
CharWin
CharXOR

CountLeft
CountRight
Descend
Empty
hb_At
hb_RAt
hb_ValToStr
IsAlpha
IsDigit
IsLower
IsUpper

JustLeft
JustRight

Left
Len
Lower
LTrim

NumAt
NumToken
PadLeft
PadRight

PadC
PadL
PadR

POSALPHA
POSCHAR
POSDEL
POSDIFF
POSEQUAL
POSINS
POSLOWER
POSRANGE
POSREPL
POSUPPER

RangeRem
RangeRepl

RAt

RemAll

RemLeft
RemRight
ReplAll

Replicate

ReplLeft

ReplRight

RestToken

Right
RTrim

SaveToken

SetAtLike
Space
Str

StrDiff

StrFormat

StrSwap

StrTran
StrZero
SubStr

TabExpand
TabPack

Token

TokenAt
TokenEnd
TokenExit
TokenInit
TokenLower
TokenNext
TokenNum
TokenSep
TokenUpper

Transform
Trim
Upper
Val

ValPos
WordOne
WordOnly
WordRem
WordRepl
WordSwap

WordToChar


Val()

Val()

Convert a number from a character type to numeric

Syntax

      Val( <cNumber> ) --> nNumber

Arguments

<cNumber> Any valid character string of numbers.

Returns

<nNumber> The numeric value of <cNumber>

Description

This function converts any number previously defined as an character expression <cNumber> into a numeric expression.

This functions is the oppose of the Str() function.

Examples

      ? Val( "31421" ) // 31421

Compliance

Clipper

Platforms

All

Files

Library is core

Seealso

Str(), Transform()

Str()

Str()

Convert a numeric expression to a character string.

Syntax

      Str( <nNumber>,  [<nLength>],  [<nDecimals>] ) --> cNumber

Arguments

<nNumber> is the numeric expression to be converted to a character string.

<nLength> is the length of the character string to return, including decimal digits, decimal point, and sign.

<nDecimals> is the number of decimal places to return.

Returns

Str() returns <nNumber> formatted as a character string. If the optional length and decimal arguments are not specified, Str() returns the character string according to the following rules:

Results of Str() with No Optional Arguments

      Expression               Return Value Length
      ------------------------ -----------------------------------
      Field Variable           Field length plus decimals
      Expressions/constants    Minimum of 10 digits plus decimals
      Val()                    Minimum of 3 digits
      Month()/Day()            3 digits
      Year()                   5 digits
      RecNo()                  7 digits

Description

Str() is a numeric conversion function that converts numeric values to character strings. It is commonly used to concatenate numeric values to character strings. Str() has applications displaying numbers, creating codes such as part numbers from numeric values, and creating index keys that combine numeric and character data.

Str() is like Transform(), which formats numeric values as character strings using a mask instead of length and decimal specifications.

The inverse of Str() is Val(), which converts character numbers to numerics.

* If <nLength> is less than the number of whole number digits in <nNumber>, Str() returns asterisks instead of the number.

* If <nLength> is less than the number of decimal digits required for the decimal portion of the returned string, Harbour rounds the number to the available number of decimal places.

* If <nLength> is specified but <nDecimals> is omitted (no decimal places), the return value is rounded to an integer.

Examples

      ? Str( 10,  6,  2 ) // " 10.00"
      ? Str( -10,  8,  2 ) // "  -10.00"

Compliance

Clipper

Files

Library is core

Seealso

StrZero(), Transform(), Val()

@…SAY

@…SAY

Displays data at specified coordinates of the current device.

Syntax

      @ <nRow>,<nCol> SAY <xValue> [ PICTURE <cPict> ] [COLOR <cColor>]

Arguments

<nRow> Row coordinate

<nCol> Column coordinate

<xValue> Value to display

<cPict> PICTURE format

<cColor> Color string

Description

This command displays the contents of <xValue> at row column coordinates <nRow>, <nCol>. A PICTURE clause may be specified in <cPict>. If the current device is set to the printer, the output will go to the printer; the default is for all output to go to the screen.

For a complete list of PICTURES templates and functions, see the @…GET command.

Examples

      PROCEDURE Main()
         CLS
         @ 2, 1 SAY "Harbour"
         @ 3, 1 SAY "is" COLOR "b/r+"
         @ 4, 1 SAY "Power" PICTURE "@!"
         RETURN

Tests

      See Examples

Compliance

Clipper

Platforms

All

Seealso

@…GET, SET DEVICE, TRANSFORM()