hb_N_O - Petewg/harbour-core GitHub Wiki

πŸ”™ Home

  • hb_ntoc( <nValue>, [nDecs] ) ➜ cValue
    This function converts the given numeric value to a string value, while (trying to) keep all or at least nDecs significant 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 if NIL or non-numeric value was passed, this function (same as hb_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 of hb_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 named hb_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 given nValue, which is a numeric value that might have been obtained by a previous call of counterpart function hb_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. x86 for 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 a null character.

  • 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 as ALL_FILEs wildcard 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 of hb_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: Function hb_osIsWin7() and later, was included in 19688 revision 2019-02-11 13:43, hence they're not available in earlier versions.
    NOTE 3: There exists a similar win_osIsXXX() function family, into HBWIN library.

  • hb_osNewLine() ➜ cEOL
    returns the character used as end-of-line marker. Deprecated! Use hb_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! Use hb_ps() instead.

πŸ”™ Home

⚠️ **GitHub.com Fallback** ⚠️