hb_N_O - Petewg/harbour-core GitHub Wiki
-
hb_ntoc(
<nValue>, [nDecs]) β cValue
This function converts the given numeric value to a string value, while (trying to) keep all or at leastnDecssignificant digits in double numbers, unless<nDecs>is lesser than actual decimal digits of<nValue>, in which case the result will be rounded.
SET DECIMAL setting has no effect on the returned value (ignored), which means that, unlike f.e. Str(), all non-sginficant digits (e.g.: trailing decimal zeros) will be removed. Likewise, all leading empty spaces will be trimmed.
Returns "stringified" value of<nValue>, preserving all (or at least<nDecs>) significant digits, if any.
NOTE: validity of<nValue>is not verified, which means that ifNILornon-numericvalue was passed, this function (same ashb_ntos()) will return a null string and will NOT cause an RTE (unlike f.e.:Str()).
π This is a new function, available after 2016-06-20 21:59 UTC+0200 commit (it is not available in earlier versions). -
hb_NToHour(
<nTimeDiff>) β nHours
(see below) -
hb_NToMin (
<nTimeDiff>) β nMinutes
(see below) -
hb_NToSec (
<nTimeDiff>) β nSeconds
(see below) -
hb_NToMSec(
<nTimeDiff>) β nMilliseconds
(see below)The above four functions convert the
<nTimeDiff>time (representing days and/or fraction of day) difference to hours, minutes, seconds and milliseconds respectively.
The returned value is a floating point number with fractional part representing the rest (decimal remainder) of conversion, except ofhb_NToMSec()function which returns milliseconds as an integer value.
NOTE 1: new functions, available after 2016-12-15 12:51 UTC+0100 commit (they are not available in earlier versions).
NOTE 2: These functions must not be confused with similarly namedhb_Hour(), hb_Minutes(), hb_Sec()since the above ones do convert the numeric time difference (time span) between two timestamps while the other ones just extract specific members of a given timestamp.
example:
t1 := hb_DateTime() - 0.3
t2 := hb_DateTime() - t1
? hb_NToHour( t2 )
? hb_NToMin ( t2 )
? hb_NToSec ( t2 )
? hb_NToMSec( t2 )
//
? hb_NtoHour(1) // --> 24.00 hours
? hb_NtoHour(0.2) // --> 4.80 hours-
hb_ntos(
<nValue>) β cSstring
converts any numeric value to a string, trimming all the surplus spaces, equivalent to 'LTrim(Str( nNumber ))'.
Returns either "stringified" (converted to string)<nValue>or a null string, if the<nValue>passed is not numeric or NIL (i.e.: not passed). Worth noting that no RTE occurs when improper values passed. -
hb_NtoT(
<nValue>) β tTimeStamp
converts to a timestamp the givennValue, which is a numeric value that might have been obtained by a previous call of counterpart functionhb_TtoN(). -
hb_NumToHex(
<nDecNumber> [, <nHexDigits> ]) β cHexNumber
Transforms a decimal numeric value (or pointer) to a hexadecimal format (string). The length of the resulting string can be defined by<nHexDigits>, However, care must be taken to avoid truncating the returned string that shall happen if the given<nHexDigits>is less than the actual length of the transformed number. On the other hand, if no<nHexDigits>specified, the resulting string is not left-padded with leading zeros (as is the conventional hexadecimal representation format, where a number of zeros, necessary to complete a total length of 8 or 16 and rarely 32 digits, are added to the left of hexadecimal value), which thing, in some specific cases, can be annoying/unwanted. (It's possible, for example, the returned string to have odd number length, which in case you want to parse it into pairs of two will produce unsuitable results).
-
hb_osCPU() β xCPU
returns CPU architecture specifier. E.g.x86for Intel's 8-16-32bit processors. -
hb_osDriveSeparator() β cDriveSeparator
returns the character used by the OS as drive separator; (not sure whether the term 'separator' is accurate here, --perhaps 'suffix' or 'designator' it'd be more proper?). On Windows it'll return:(the colon character) while on OSes that do not support drive letter designators (e.g. Linux), it will return anullcharacter. -
hb_osError() β nError
returns the error code of last I/O operation, as it is identified/reported by OS. -
hb_osFileMask() β cFileMask
returns the constant character(s) sequence used asALL_FILEswildcard mask, suitable for the running OS, (it is a single asterisk*for 'NIXes and a dot separated double asterisk*.*for WIN). -
hb_osIs64bit() β .T.|.F.
-
hb_osIsWin2K() β .T.|.F.
-
hb_osIsWin9x() β .T.|.F.
-
hb_osIsWinCE() β .T.|.F.
-
hb_osIsWinNT() β .T.|.F.
-
hb_osIsWinVista() β .T.|.F.
-
hb_osIsWin7() β .T.|.F.
-
hb_osIsWin8() β .T.|.F.
-
hb_osIsWin81() β .T.|.F.
-
hb_osIsWin10() β .T.|.F.
NOTE 1: all the above
hb_osIsWinXXX()(with the exception ofhb_osIsWinCE()) will actually return.T.when the Windows version is equal to or upper than the queried one. For example:hb_osIsWin2K()returns.T.on a machine running Win2k or any later version (e.g.: WinXP, Vista or Win7). Likewise,hb_osIsWinNT()returns .T. for all windows versions from Win2K and following.
NOTE 2: Functionhb_osIsWin7()and later, was included in19688 revision 2019-02-11 13:43, hence they're not available in earlier versions.
NOTE 3: There exists a similarwin_osIsXXX()function family, into HBWIN library. -
hb_osNewLine() β cEOL
returns the character used as end-of-line marker. Deprecated! Usehb_eol()instead of this "exceptionally long and hard to type" function. -
hb_osPathDelimiters() β cPathDelimiters
returns\/:on windows,/on *nixes. -
hb_OsPathListSeparator() β PathListSeparator
returns the character used as separator in a list of paths. It is semicolon;on windows, colon:on *nixes. -
hb_OsPathSeparator() β OSpathSepator
returns the character used as path separator; usually backslash\on Windows, slash/on *nixes. Deprecated! Usehb_ps()instead.
* Copyright Β© 2016βpresent Pete D.