FT_AT2() Find position of the nth occurrence of a substring FT_BITCLR() Clear (reset) selected bit in a byte FT_BITSET() Set selected bit in a byte FT_BYTEAND() Perform bit-wise AND on two ASCII characters (bytes) FT_BYTENEG() Perform bit-wise negation on an ASCII character FT_BYTENOT() Perform bit-wise NOT on an ASCII character (byte) FT_BYTEOR() Perform bit-wise OR on two ASCII characters (bytes) FT_BYTEXOR() Perform bit-wise XOR on two ASCII characters (bytes) FT_FINDITH() Find the "ith" occurrence of a substring within a string FT_ISBIT() Test the status of an individual bit FT_ISBITON() Determine the state of individual bits in a number FT_METAPH() Convert a character string to MetaPhone format FT_NOOCCUR() Find the number of times one string occurs in another FT_PCHR() Convert printer control codes FT_PROPER() Convert a string to proper-name case
FT_PROPER() Convert a string to proper-name case Syntax FT_PROPER( <cString> ) -> cProperName Arguments <cString> is the string to be converted. Returns A string of the same length as <cString>, only converted to proper name case (upper/lower case). Description FT_PROPER() uses a brute-force algorithm to convert a string to propername case. First, it capitalizes the first letter of all words starting after a blank, dash, or apostrophe. This catches most names, including special cases such as names beginning with O' (O'Malley, O'Reilly) and hyphenated names (such as Susan Chia-Mei Lo). Next, it does a specific adjustment for words beginning in "Mc" It finds the first 'Mc' and capitalizes the next character after it. It does this for all occurrences of Mc. The original FT_PROPER() was written in Clipper by Glenn Scott and Mark Zechiel; it was re-written in C (and thus, optimized and enhanced) by Robert DiFalco. Examples FUNCTION main( cStr ) OutStd( FT_PROPER( cStr ) + chr(13) + chr(10) ) RETURN ( nil ) Source: PROPER.C Author: Robert DiFalco and Glenn Scott
FT_PCHR() Convert printer control codes Syntax FT_PCHR( <cString> ) -> <cPrinterFormat> Arguments <cString> is the representation of the printer control codes in text, numeric, hexadecimal, Epson command format, or any combination separated by commas. Returns A character string of printer control codes. Description This function is useful for allowing the user to enter printer control codes in text (enclosed in double quotes), numeric, hexadecimal, or Epson commands preceded by a slash and returns the printer control code equivalent. NOTES" - Combinations of text, numbers, hex, and commands must be separated by commas ("A",27,&1B,/RESET). - Text must be enclosed in double quotes ("x"). - Hexadecimal must be preceded by an ampersand (&1B). - Epson commands, listed below, must be preceded by a forward slash (/RESET). Epson commands: (slash commands are specific to the Epson) Job Control: /RESET or /INIT Reset or initialize the printer /BELL or /BEEP Cause the printer's speaker to beep (not HS) /CAN Clear print buffers (not MX) /SLOW Set low speed mode (not CR, HS, MX) /FAST Cancel low speed mode (not CR, HS, MX) /ONE Select Unidirectional mode /TWO Select Directional mode /ON Activate printer /OFF Turn off printer /FF or /EJECT Form Feed Page Control: /1/6 Set 6 lines per inch /1/8 Set 8 lines per inch /SKIP Set Skip perforation ON /SKIPOFF Set Skip perforation OFF Font Selection and Manipulation: /ITALIC Select italic char. set (only FX86, EX, LX, no LQ-1500, SX) /GRAPHIC Select graphic char. set (only FX86, EX, LX, no LQ-1500, SX) /ROMAN Choose Roman font /SANS Choose Sans Serif font /DRAFT Choose draft /NLQ Choose near letter quality /PICA Choose 10 chars per inch /ELITE Choose 12 chars per inch /COND or /SI Choose 15 chars per inch /EMPH Turn emphasize on /EMPHOFF Turn emphasize off /SPANISH Select spanish international char set /USA Select USA international char set Examples cSetUp := '27,116,1' Set Print ON ? FT_PCHR( cSetUp ) -> (CHR(27)+CHR(116)+CHR(1)) <select Epson char. graphics> ? FT_PCHR( '27,"x",0' ) -> (CHR(27)+CHR(120)+CHR(0)) <Epson draft mode> ? FT_PCHR( '&1B,"E"' ) -> (CHR(27)+CHR(69)) <HP reset> ? FT_PCHR( '/ELITE,/NLQ' ) ->(CHR(27)+CHR(77)+CHR(27)+CHR(120)+CHR(1)) <Epson elite & near letter quality> Source: PCHR.PRG Author: Jim Gale
FT_NOOCCUR() Find the number of times one string occurs in another Syntax FT_NOOCCUR( <cCheckFor>, <cCheckIn> ; [, <lIgnoreCase> ] ) -> <nOccurrences> Arguments <cCheckFor> is the string to search for <cCheckIn> is the string to search <lIgnoreCase> is a boolean variable to force case sensitivity (optional, defaults to .F.). Returns The number of times <cCheckFor> appears in <cCheckIn> Description This function finds the number of times a string occurs in a second string. Examples // Find the number of times "the" appears in cMemoString, case // insensitive nNoOfOccurrences := FT_NOOCCUR( "the", cMemoString ) // Find the number of times "the" appears in cMemoString, case // sensitive nNoOfOccurrences := FT_NOOCCUR( "the", cMemoString, TRUE ) Source: NOOCCUR.PRG Author: David Husnian
FT_METAPH() Convert a character string to MetaPhone format Syntax FT_METAPH( <cName> [, <nSize> ] ) -> cMetaPhone Arguments <cName> is the character string to convert <nSize> is the length of the character string to be returned. If not specified the default length is 4 bytes. Returns A phonetically spelled character string Description This function is a character function use to index and search for sound-alike or phonetic matches. It is an alternative to the SOUNDEX() function, and addresses some basic pronunciation rules, by looking at surrounding letters to determine how parts of the string are pronounced. FT_METAPH() will group sound-alikes together, and forgive shortcomings in spelling ability. Examples USE Persons INDEX ON FT_METAPH( LastName ) TO LastName SEEK FT_METAPH( "Philmore" ) ? FOUND(), LastName // Result: .T. Philmore SEEK FT_METAPH( "Fillmore" ) ? FOUND(), LastName // Result: .T. Philmore Source: METAPH.PRG Author: Dave Adams
FT_ISBITON() Determine the state of individual bits in a number Syntax FT_ISBITON( <nNumber>, <nBit> ) -> lResult Arguments <nNumber> is an integer for which a bit state needs to be checked. <nBit> is a number from 0 to 15 that indicates which bit to test. Returns .T. if the specified bit was on., .F. if off. Description This function is useful when dealing with binary integers. It will come in very handy if you use the FT_INT86() function, because the CPU flags are returned as a series of bits. Using this function, you can determine the state of each CPU flag. Examples if FT_ISBITON( nCPUFlags, 0 ) Qout( "The carry flag was set." ) endif if FT_ISBITON( nCPUFlags, 7 ) Qout( "The sign flag was set." ) endif Source: ISBITON.PRG Author: Ted Means
FT_ISBIT() Test the status of an individual bit Syntax FT_ISBIT( <cByte>, <nBitPos> ) -> lResult Arguments <cByte> is a character from CHR(0) to CHR(255) <nBitPos> is a number from 0 to 7 conforming to standard right-to-left bit-numbering convention and representing the position of the bit within the byte. Returns .T. if designated bit is set (1), .F. if not set (0), NIL if invalid parameters. Description Tests for status of any selected bit in the byte passed as a parameter. Byte must be presented in CHR() form, as a literal constant, or as the one-byte character result of an expression. This function is presented to illustrate that bit-wise operations are possible with Clipper code. For greater speed, write .C or .ASM versions and use the Clipper Extend system. Examples This code tests whether bit 3 is set in the byte represented by CHR(107): lBitflag := FT_ISBIT(CHR(107), 3) ? lBitflag // result: .T. This code tests whether bit 5 is set in the byte represented by ASCII 65 (letter 'A') ? FT_ISBIT('A', 5) // result: .F. For a demonstration of Clipper bit manipulations, compile and link the program BITTEST.PRG in the Nanforum Toolkit source code. Source: ISBIT.PRG Author: Forest Belt, Computer Diagnostic Services, Inc.
See Also: FT_BITSET() FT_BITCLR()