Harbour All Functions – S

SaveToken

SayScreen

Seconds
Secs

Select

Set

SetAtLike

SetDate

SetKey

SetMode

SetPrec

SetTime

SetTypeahead

Sign

Sin

SinH

Space

Sqrt

Str

StrDiff

StrFormat

StrSwap
StrTran
StrZero
SubStr

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


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()

Int()

INT()

Return the integer port of a numeric value.

Syntax

      INT( <nNumber> ) --> <nIntNumber>

Arguments

<nNumber> Any numeric value.

Returns

<nIntNumber> The integer portion of the numeric value.

Description

This function converts a numeric expression to an integer. All decimal digits are truncated. This function does not round a value upward or downward; it merely truncates a number at the decimal point.

Examples

      SET DECIMAL TO 5
      ? INT( 632512.62541 )
      ? INT( 845414111.91440 )

Compliance

Clipper

Platforms

All

Files

Library is rtl

Seealso

ROUND(), STRZERO()

Directory List

Reinvention of wheel ?

Not quite …

Main difference is allowing file(s) and folder(s) selection together.

Another difference is implementing of <lNoChangeDir> parameter. Unlike GetFile(), GetDIRList() uses this value  for allowing change directory ability to user.

Furthermore sorting grid columns by three (not two) ways, GetVolumLabel(), List2Arry() and Arry2List()  functions may be useful.

Also, test program ( TestGDL.prg ) may be a sample for .fmg based application.

Download here ( source only ).