FT_AADDITION() Add elements unique of source array to target array FT_AAVG() Average numeric values in an array FT_ADESSORT() Sort an array in descending order FT_AEMAXLEN() Find longest element within an array FT_AEMINLEN() Find shortest element within an array FT_AMEDIAN() Find middle value in array, or average of two middle values FT_ANOMATCHES() Find the number of array elements meeting a condition FT_AREDIT() 2 dimensional array editing function using TBrowse FT_ASUM() Sum the elements of an array FT_BYT2BIT() Convert byte to string of 1's and 0's FT_BYT2HEX() Convert byte to hexadecimal version of its binary value FT_CHDIR() Change the current directory FT_D2E() Convert decimal to scientific notation FT_DEC2BIN() Convert decimal to binary FT_DEFAULT() Retrieve and optionally change the current default drive FT_DOSVER() Return the current DOS major and minor version as a string FT_DSKFREE() Return the amount of available disk space FT_DSKSIZE() Return the maximum capacity of a fixed disk FT_E2D() Convert scientific notation string to a decimal FT_ESCCODE() Convert Lotus style escape codes FT_HEX2DEC() Convert a hex number to decimal FT_INVCLR() Get the inverse of a color FT_NTOW() Translate numeric value to words FT_RESTARR() Restore a Clipper array from a disc file FT_SAVEARR() Save Clipper array to a disc file. FT_SQZN() Compress a numeric value into a character string FT_STOD() Convert a date string to a Clipper date data type FT_UNSQZN() Uncompress a numeric compressed by FT_XTOY() Convert from any data type to any other data type
Daily Archives: September 17, 2013
FT Conversion
FT_BYT2BIT() Convert byte to string of 1's and 0's FT_BYT2HEX() Convert byte to hexadecimal version of its binary value FT_D2E() Convert decimal to scientific notation FT_DEC2BIN() Convert decimal to binary FT_E2D() Convert scientific notation string to a decimal FT_ESCCODE() Convert Lotus style escape codes FT_HEX2DEC() Convert a hex number to decimal FT_INVCLR() Get the inverse of a color FT_NTOW() Translate numeric value to words FT_SQZN() Compress a numeric value into a character string FT_STOD() Convert a date string to a Clipper date data type FT_UNSQZN() Uncompress a numeric compressed by FT_SQZN() FT_XTOY() Convert from any data type to any other data type
FT_XTOY
FT_XTOY() Convert from any data type to any other data type Syntax FT_XTOY( <xValueToConvert>, <cTypeToConvertTo> ; [, <lWantYesNo> ] ) -> xResult Arguments <xValueToConvert> is the value to convert. <cTypeToConvertTo> is the type of value to convert to ("C","D","L","N","A" or "B"). <lWantYesNo> is a logical to signal if 'Y' or 'N' is to be returned if Converting a logical, otherwise '.T.' or '.F.' will be returned for logicals. Returns The original value converted to the new type. Description This function converts a value of character, date, numeric, logical, array or code block type to any of the other type. While it is guaranteed to return a value of the correct type, that value may not be meaningful (i.e., converting from a code block returns an EMPTY() value of the desired type). Examples nNumericValue := FT_XTOY(cInputValue, "N") IF (FT_XTOY(nInputValue, "L")) Source: ANY2ANY.PRG Author: David Husnian
FT_UNSQZN
FT_UNSQZN() Uncompress a numeric compressed by FT_SQZN() ------------------------------------------------------------------------------ Syntax FT_UNSQZN( <cCompressed>, <nSize> [, <nDecimals> ] ) -> nValue Arguments <cCompressed> - Compressed string, obtained from FT_SQZN() <nSize> - Size of numeric field <nDecimals> - Optional number of decimal places Returns nValue - Uncompressed numeric value Description The FT_UNSQZN function returns the numeric value from the compressed string. The compression is 50% the storage space of the original number. The original number must have been compressed using the FT_SQZN() function. This function, along with FT_SQZN() can be used to reduce disk storage requirements for numeric fields in a database file. Examples mcust_id := FT_UNSQZN(TRANS->cust_id,8),; mamount := FT_UNSQZN(TRANS->amount,12,2) Source: SQZN.PRG Author: Joseph D. Booth, Sr.
See Also: FT_SQZN()
FT_STOD
FT_STOD() Convert a date string to a Clipper date data type Syntax FT_STOD( <cDateStr> ) -> dDateType Arguments <cDateStr> is a Clipper string in the format "CCYYMMDD". Returns A Clipper date type. Description This function allows the programmer to hard code a date into the program without knowing what the current date type is. This function is the converse of the Clipper DTOS() function. Examples LOCAL dMyDate dMyDate := FT_STOD( "19901127" ) Source: STOD.C Author: Clayton Neff
FT_SQZN
FT_SQZN() Compress a numeric value into a character string Syntax FT_SQZN( <nValue> [, <nSize> [, <nDecimals> ] ] ) -> cCompressed Arguments nValue - The numeric value to be compressed nSize - Optional size of numeric field, defaults to 10 nDecimals - Optional number of decimal places, defaults to 0 Returns cCompressed - Compressed string, 50% the size of nSize Description The FT_SQZN function allows a numeric value to be compressed when stored in the database. The compression is 50% the storage space of the original number. The companion function, FT_UNSQZN returns the original number from the compressed string. Examples replace TRANS->cust_id with FT_SQZN(mcust_id,8),; TRANS->amount with FT_SQZN(mamount,12,2) Source: SQZN.PRG Author: Joseph D. Booth, Sr.
FT_NTOW
FT_NTOW() Translate numeric value to words Syntax FT_NTOW( <nNumber> ) -> cWords Arguments <nNumber> An integer to translate Returns A text string representing <nNumber> Description Translates numeric input to a text string. FT_NTOW is intended to be used with integers only. Since I don't know what your application will be, I can't assume the type of fraction you want returned (ninety nine cents, 99/100, .99, etc). If you want the fraction in words, just pass it as an integer. Do not pass a negative number! Handle negative numbers any way you need to in your code. (ie: CR, DB, Negative, Minus, etc.) Also, numeric 0 is returned as a null string. You will need to make a decision how to output it (zero dollars, no dollars, etc). Examples ? FT_NTOW( 999 ) -> Nine Hundred Ninety Nine ? FT_NTOW( 1000 ) -> One Thousand ? FT_NTOW( 23 ) + " Dollars and " + FT_NTOW( 99 ) + " Cents" -> Twenty Three Dollars and Ninety Nine Cents ? FT_NTOW( 23 ) + " Dollars and " + "99/100" -> Twenty Three Dollars and 99/100 x := -23.99 cents := str( (x - int( x )) * 100, 2, 0 ) + "/100" x := int( x ) string := iif( x < 0, "Credit of ", "Debit of " ) ? string + FT_NTOW( abs(x) ) + " Dollars and " + "99/100" -> Credit of Twenty Three Dollars and 99/100 Source: NTOW.PRG Author: Gary Baren
FT_INVCLR
FT_INVCLR() Get the inverse of a color ------------------------------------------------------------------------------ Syntax FT_INVCLR( [ <cDsrdColor> ] ) -> cColor Arguments <cDsrdColor> is the color to get the inverse of. Defaults to current color. Returns The inverse of the passed color. Description This function inverts a passed color (in the Clipper format: ??/??), e.g., "W/N" is converted to "N/W". Examples cInverse := FT_INVCLR() // Get Inverse of Current Color cInvErr := FT_INVCLR( cErrColor ) // Get Inverse of cErrorColor Source: INVCLR.PRG Author: David Husnian
FT_HEX2DEC
FT_HEX2DEC() Convert a hex number to decimal Syntax FT_HEX2DEC( <cHexNum> ) -> nDecNum Arguments <cHexNum> is a character string representing a hex number. Returns A decimal number. Description Converts a hexadecimal number to a BASE 10 decimal number. Useful for using FT_INT86(). Examples FT_INT86( HEX2DEC( "21" ), aRegs ) Converts 21h, the Dos Interrupt, to its decimal equivalent, 33, for use by FT_INT86(). Source: HEX2DEC.PRG Author: Robert A. DiFalco
FT_ESCCODE
FT_ESCCODE() Convert Lotus style escape codes Syntax FT_ESCCODE( <cASCII> ) -> <cPrinterFormat> Arguments <cASCII> is the ASCII representation of the printer control codes in Lotus 123 format (e.g. "27E" for Chr(27)+"E") "\nnn" will be converted to Chr(nnn) "\\" will be converted to "\" Returns The binary version of an ASCII coded printer setup string. Description This function is useful for allowing the user to enter printer control codes in Lotus-style ASCII format, and then having this function convert that code to the format that the printer needs to receive. Examples cSetup = "15" // default = Epson compressed print UserInput( @cSetup ) // Let user modify setup code SET DEVICE TO PRINT // get ready to print ?? FT_ESCCODE( cSetup ) // Output the converted code Source: PRTESC.PRG Author: Steven Tyrakowski