hb_T - Petewg/harbour-core GitHub Wiki
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 returns1
, that is, entire thecString
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
or0
.
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 is0-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 aREQUEST 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 formatYYYY-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 timetTIMESTAMP
toUTC
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 atimestamp
ordate
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 bytimestamp
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 aJulian
date value, and the decimal part is the time part represented as milliseconds from midnight.
NOTE: the returnednValue
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 asYYYYMMDDHHMMSSFFF
. -
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. Thehb_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).