hb_T - Petewg/harbour-core GitHub Wiki

🔙 Home

Note: All the hb_Thread***() functions have been moved in this MultiThreading separate page.

  • hb_TokenCount(<cString>, [<cDelimiter>], [<lSkipStrings>, [<lDoubleQuoteOnly>]]) nTokens
    returns the number of tokens (i.e. number of individual words in the string, being separated by <cDelimiter> or by a space, if no delimiter given).
    If <cDelimiter> specified and <cDelimiter> not found in <cString> this function returns 1, that is, entire the cString is counted as one token, which, depending on occasion, might be not what was expected/aimed to be returned.
    See also: hb_Atokens() for more detailed info about parameters and default values.

  • hb_TokenGet( <cString>, <nToken> [, <cDelimiter>, <lSkipStrings>, <lDoubleQuoteOnly>] ) cToken
    returns the <nToken>'th token in the string.
    If there is no <nToken> it returns null string. It will also return a null string if <nToken> == NIL or 0.
    See also: hb_Atokens() for more detailed info about parameters and default values.

  • hb_TokenPtr( <cString>, [@]<nPos> [, <cDelim>, <lSkipStrings>, <lDoubleQuoteOnly>] ) cToken
    returns the first token found in a string. First, it will search for a token separator starting from <nPos> character and will return the following token (or portion of it). It is 0-based, which means you have to pass <nPos>=0 to get the 1st token. If <nPos> is passed by @reference, it will hold the position from where the next token search will start.

  • hb_Translate( <cString>, [<FromCodePageID>], [<ToCodePageID>] ) cConvertedString
    changes character encoding of given string from one code-page to the other.
    If either of <FromCodePageID> or <ToCodePageID> is ommited then current (hb_vmCDP) codepage is used. If none of them is specified or is invalid or not available, an RTE occurs, which means that before invoking the function, the code page module(s) needed for conversion must have been linked (using a REQUEST HB_CODEPAGE_XXXXX statement).
    For a complete list of code-pages supported by Harbour see hb_cdpList() function. See also, hb_strToUTF8() similar function.
    hb_Translate() example of usage:
       REQUEST hb_codepage_elwin, hb_codepage_utf8ex  
       cUTF8String := hb_Translate( "τα πάντα ρεί", "ELWIN", "UTF8" ) 
      // converts given string from codepage `cp-1253` to `UTF-8`

  • hb_TSToStr( <tTimeStamp> [, <lPacked>] ) cTimeStamp
    returns <cTimeStamp> with the format YYYY-MM-DD hh:mm:ss.fff. If <lPacked> is .T. empty elements of the timestamp will be stripped out.

  • hb_TSToUTC( [<tLocalTime>] ) tUtcTime
    converts a local time tTIMESTAMP to UTC time.

  • hb_TtoC( <dDate>|<tTimeStamp> [, <cDateFormat>, <cTimeFormat>] ) cTimeStamp
    converts date or timestamp values to timestamp formatted strings.

  • hb_TtoD( <dDate>|<tTimeStamp> [, @<nSeconds>|@<cTime>, @<cTimeFormat>] ) dDate
    extracts date and time information from a timestamp or date value. It returns the date part as a date value. If <@nSeconds> or @<cTime> parameter is passed by reference then it obtains either the number of seconds in given day specified by timestamp value or the time as time string. If no <cTimeFormat> passed, then _SET_TIMEFORMAT is used.

  • hb_TtoN( <dDate>|<tTimeStamp> ) nValue
    converts a date or timestamp value to numeric value. The integer part of returned <nValue> is the date part represented as a Julian date value, and the decimal part is the time part represented as milliseconds from midnight.
    NOTE: the returned nValue must not be confused with Unix time number, since they're totally different!

  • hb_TtoS( <dDate>|<tTimeStamp> ) cDateTime
    converts a date or timestamp value to string formated as YYYYMMDDHHMMSSFFF.

  • hb_TToHour( <tTimeStamp> ) nHours

  • hb_TToMin ( <tTimeStamp> ) nMinutes

  • hb_TToSec ( <tTimeStamp> ) nSeconds

  • hb_TToMSec( <tTimeStamp> ) nMilliseconds
    The above four functions calculate/convert the <tTimeStamp> timestamp value to hours, minutes, seconds and milliseconds respectively.
    All but hb_TToMSec() functions return a floating point number, where the fractional part represents the rest (decimal remainder) of the conversion. The hb_TToMSec() function returns milliseconds as an integer value.
    NOTE: they are new functions, available for use after 2016-12-15 12:51 UTC+0100 commit (they are not available in earlier Harbour versions).

🔙 Home

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