Harbour Reference Guide

BinToDec()Source code βŒƒΒ | ☰ |Β Improve this doc

Converts a binary value to decimal
Syntax
BinToDec( <cN> ) β†’ cNr
Arguments
cN Number to be converted
Returns
cNr Number converted
Description
This function converts a string cN from an binary value to a numeric decimal value.
Platforms
Available on all platforms
File
Library is hbmisc
Tag
Conversion Tools
See also

DecToBin()Source code βŒƒΒ | ☰ |Β Improve this doc

Converts a decimal value to binary
Syntax
DecToBin( <cN> ) β†’ cNr
Arguments
cN Number to be converted
Returns
cNr Number converted
Description
This function converts a string cN from an decimal value to an binary value.
Platforms
Available on all platforms
File
Library is hbmisc
Tag
Conversion Tools
See also

DecToHexa()Source code βŒƒΒ | ☰ |Β Improve this doc

Converts a decimal value to hexadecimal
Syntax
DecToHexa( <cN> ) β†’ cNr
Arguments
cN Number to be converted
Returns
cNr Number converted
Description
This function converts a string cN from an decimal value to an hexadecimal value.
Platforms
Available on all platforms
File
Library is hbmisc
Tag
Conversion Tools
See also

DecToOctal()Source code βŒƒΒ | ☰ |Β Improve this doc

Converts a decimal value to octal
Syntax
DecToOctal( <cN> ) β†’ cNr
Arguments
cN Number to be converted
Returns
cNr Number converted
Description
This function converts a string cN from an decimal value to an octal value.
Platforms
Available on all platforms
File
Library is hbmisc
Tag
Conversion Tools
See also

HexaToDec()Source code βŒƒΒ | ☰ |Β Improve this doc

Converts a hexadecimal value to decimal
Syntax
HexaToDec( <cN> ) β†’ cNr
Arguments
cN Number to be converted
Returns
cNr Number converted
Description
This function converts a string cN from an hexadecimal value to a numeric decimal value.
Platforms
Available on all platforms
File
Library is hbmisc
Tag
Conversion Tools
See also

IsBin()Source code βŒƒΒ | ☰ |Β Improve this doc

Check if the value is a binary number
Syntax
IsBin( <cN> ) β†’ cNr
Arguments
cN String to be checked
Returns
cNr .T. if the string is binary, otherwise .F.
Description
check if the passed string is a binary number or not
Platforms
Available on all platforms
File
Library is hbmisc
Tag
Conversion Tools
See also

IsDec()Source code βŒƒΒ | ☰ |Β Improve this doc

Check if the value is a Decimal Number
Syntax
IsDec( <cN> ) β†’ cNr
Arguments
cN String to be checked
Returns
cNr .T. if the string is decimal; otherwise .F.
Description
check if the passed string is a decimal number or not
Platforms
Available on all platforms
File
Library is hbmisc
Tag
Conversion Tools
See also

IsHexa()Source code βŒƒΒ | ☰ |Β Improve this doc

Check if the value is a hexadecimal number
Syntax
IsHexa( <cN> ) β†’ cNr
Arguments
cN String to be checked
Returns
cNr .T. if the string is hexadecimal; otherwise .F.
Description
check if the passed string is a hexadecimal number or not
Platforms
Available on all platforms
File
Library is hbmisc
Tag
Conversion Tools
See also

IsOctal()Source code βŒƒΒ | ☰ |Β Improve this doc

Check if the value is a octal number
Syntax
IsOctal( <cN> ) β†’ cNr
Arguments
cN String to be checked
Returns
cNr .T. if the string is octal; otherwise .F.
Description
check if the passed string is a octal number or not
Platforms
Available on all platforms
File
Library is hbmisc
Tag
Conversion Tools
See also

OctalToDec()Source code βŒƒΒ | ☰ |Β Improve this doc

Converts a octal value to decimal
Syntax
OctalToDec( <cN> ) β†’ cNr
Arguments
cN Number to be converted
Returns
cNr Number converted
Description
This function converts a string cN from an octal value to a numeric decimal value.
Platforms
Available on all platforms
File
Library is hbmisc
Tag
Conversion Tools
See also

ADays()Source code βŒƒΒ | ☰ |Β Improve this doc

Returns an array with the days names.
Syntax
ADays() β†’ aDays
Arguments
None
Returns
aDays The array which holds the days names.
Description
This function returns an array with all the days names in the selected current language.
Examples
LOCAL aDays := ADays()
? aDays[ 1 ]  // --> Sunday
? aDays[ 1 ]  // --> Domingo (if the selected language is Spanish)
Status
Ready
Compliance
Harbour specific
Platforms
Available on all platforms
File
Library is hbmisc
Tag
Date
See also

AMonths()Source code βŒƒΒ | ☰ |Β Improve this doc

Returns an array with the months names.
Syntax
AMonths() β†’ aMonths
Arguments
None
Returns
aMonths The array which holds the months names.
Description
This function returns an array with all the months names in the selected current language.
Examples
LOCAL aMonths := AMonths()
? aMonths[ 1 ]  // --> January
? aMonths[ 1 ]  // --> Enero (if the selected language is Spanish)
Status
Ready
Compliance
Harbour specific
Platforms
Available on all platforms
File
Library is hbmisc
Tag
Date
See also

hbmisc_DaysInMonth()Source code βŒƒΒ | ☰ |Β Improve this doc

Gets the days in a month.
Syntax
hbmisc_DaysInMonth( <dDate> ) β†’ nDays
Arguments
dDate A valid date.
Returns
nDays The number of days of the month.
Description
This function returns the number of days of the given date month.
Examples
? hbmisc_DaysInMonth( 0d20000101 )  // --> 31
? hbmisc_DaysInMonth( 0d20000201 )  // --> 29
Status
Ready
Compliance
Harbour specific
Platforms
Available on all platforms
File
Library is hbmisc
Tag
Date
See also

IsLeapYear()Source code βŒƒΒ | ☰ |Β Improve this doc

Checks if the given date is a leap year.
Syntax
IsLeapYear( <dDate> ) β†’ lTrueOrFalse
Arguments
dDate A valid date.
Returns
lTrueOrFalse A logical that indicates if the date year is leap
Description
This function returns true if the given date is a leap year and false if isn't.
Examples
? IsLeapYear( 0d20000101 )  // --> .T.
? IsLeapYear( 0d20010101 )  // --> .F.
Status
Ready
Compliance
Harbour specific
Platforms
Available on all platforms
File
Library is hbmisc
Tag
Date
See also

WoY()Source code βŒƒΒ | ☰ |Β Improve this doc

Gets the week number of the year.
Syntax
WoY( <dDate>, <lIso> ) β†’ nWeek
Arguments
dDate A valid date.
Returns
nWeek The week number lIso Flag that indicates if nWeek is in ISO format.
Description
This function returns the week number of the year for a given date. It returns the week number in ISO format (range 0 - 52, by default or passing TRUE as second parameter) or 1 - 52 if lIso is FALSE.
Examples
? WoY( 0d20000131 )       // --> 3
? WoY( 0d20000131, .F. )  // --> 4
Status
Ready
Compliance
Harbour specific
Platforms
Available on all platforms
File
Library is hbmisc
Tag
Date
See also

TFileRead()Source code βŒƒΒ | ☰ |Β Improve this doc

Read a file one line at a time
Syntax
oFile := TFileRead():New( <cFileName> [, <nReadSize> ] )
Arguments
cFileName is the required name of the file to be read.
nReadSize is the optional size to use when reading from the file. The default value is 4096 and the allowed range is 1 through 65535. Any value outside of this range causes the default value to be used.
Returns
An instance of the File Reader class
Description

TFileRead() is used to access a file one line at a time. You must specify the name of the file when an instance of the class is created.

The class data should be considered private to the class.

The class methods are as follows:

:New() Creates a new instance of the TFileRead() class.

:Open( [<nFlags>] ) Opens the file for reading. The optional nFlags

parameter can use any of the file open flags from fileio.ch. The default is FO_READ + FO_SHARED. Calling this method when the file is already open causes the next :ReadLine() to start over from the beginning of the file.

:Close() Closes the file.

:ReadLine() Returns one line from the file, stripping the

newline characters. The following sequences are treated as one newline: 1) CR CR LF; 2) CR LF; 3) LF; and 4) CR. Note: LF CR is 2 newlines.

:Name() Returns the name of the file.

:IsOpen() Returns .T. if the file is open.

:MoreToRead() Returns .T. if there are more lines to be read

(think of it as an inverse EOF function).

:Error() Returns .T. if an error has occurred.

:ErrorNo() Returns the current error code.

:ErrorMsg( [<cPre>] ) Returns a formatted error message.

Examples
LOCAL oFile := TFileRead():New( "test.txt" )
oFile:Open()
IF oFile:Error()
   ? oFile:ErrorMsg( "FileRead:" )
ELSE
   DO WHILE oFile:MoreToRead()
      ? oFile:ReadLine()
   ENDDO
   oFile:Close()
ENDIF
Status
Ready
Compliance
Not applicable
Platforms
Available on all platforms
File
Library is hbmisc
Tag
File