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
Tag Archives: FT_BYTENEG()
FT_FINDITH
FT_FINDITH() Find the "ith" occurrence of a substring within a string Syntax FT_FINDITH( <cCheckFor>, <cCheckIn>, <nWhichOccurrence> ; [, <lIgnoreCase> ] ) -> <nStringPosition> Arguments <cCheckFor> is the string to search for. <cCheckIn> is the string to search. <nWhichOccurrence> is the number of the occurrence to find. <lIgnoreCase> is a logical indicating if the search is to be case sensitive. The default is no case sensitivity (.F.). Returns The position in the string cCheckIn of the ith occurrence of cCheckFor. Description This function finds the position in a string of the "ith" time another string appears in it. Examples // Find the Position in cMemoString of // the 10th Occurrence of "the", case // insensitive nNextPosition := FT_FINDITH("the", cMemoString, 10) Source: FINDITH.PRG Author: David Husnian
See Also: FT_AT2()
FT_BYTEXOR
FT_BYTEXOR() Perform bit-wise XOR on two ASCII characters (bytes) Syntax FT_BYTEXOR( <cByte1>, <cByte2> ) -> cNewByte Arguments <cByte1> and <cByte2> are characters from CHR(0) to CHR(255). May be passed in CHR() form, as character literals, or as expressions evaluating to CHR() values. Returns Returns resulting byte, in CHR() form. If parameters are faulty, returns NIL. Description Can be used for bit-wise byte manipulation. In effect, this is a bit-by-bit XOR operation. Equivalent to XOR assembler instruction. 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 performs a bit-wise XOR on two bytes represented by CHR(32) and CHR(55): cNewByte := FT_BYTEXOR( CHR(32), CHR(55) ) ? ASC( cNewByte ) // result: 23 ? cNewByte // result: non-printable character For a demonstration of Clipper bit manipulations, compile and link the program BITTEST.PRG in the Nanforum Toolkit source code. Source: BYTEXOR.PRG Author: Forest Belt, Computer Diagnostic Services, Inc.
See Also: FT_BYTEOR() FT_BYTENOT() FT_BYTENEG() FT_BYTEAND()
FT_BYTEOR
FT_BYTEOR() Perform bit-wise OR on two ASCII characters (bytes) Syntax FT_BYTEOR( <cByte1>, <cByte2> ) -> cNewByte Arguments <cByte1> and <cByte2> are characters from CHR(0) TO CHR(255). May be passed in CHR() form, as character literals, or as expressions evaluating to CHR() values. Returns Returns resulting byte, in CHR() form. If parameters are faulty, returns NIL. Description Can be used for bit-wise byte manipulation. In effect, this is a bit-by-bit OR operation. Equivalent to OR assembler instruction. 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 performs a bit-wise OR on two bytes represented by CHR(20) and CHR(10): cNewByte := FT_BYTEOR( CHR(20), CHR(10) ) ? ASC( cNewByte ) // result: 30 ? cNewByte // result: non-printable character For a demonstration of Clipper bit manipulations, compile and link the program BITTEST.PRG in the Nanforum Toolkit source code. Source: BYTEOR.PRG Author: Forest Belt, Computer Diagnostic Services, Inc.
See Also: FT_BYTEXOR() FT_BYTENOT() FT_BYTENEG() FT_BYTEAND()
FT_BYTENOT
FT_BYTENOT() Perform bit-wise NOT on an ASCII character (byte) ------------------------------------------------------------------------------ Syntax FT_BYTENOT( <cByte> ) -> cNewByte Arguments <cByte> is a character from CHR(0) to CHR(255). May be passed in CHR() form, as character literal, or as expression evaluating to CHR() value. Returns Returns resulting byte, in CHR() form. If parameters are faulty, returns NIL. Description Can be used for bitwise byte manipulation. In effect, this is a bit-by-bit NOT (one's complement) operation. Equivalent to the NOT assembler instruction. 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 performs a bitwise NOT on byte represented by CHR(32): cNewByte := FT_BYTENOT( CHR(32) ) ? ASC( cNewByte ) // result: 223 For a demonstration of Clipper bit manipulations, compile and link the program BITTEST.PRG in the Nanforum Toolkit source code. Source: BYTENOT.PRG Author: Forest Belt, Computer Diagnostic Services, Inc.
See Also: FT_BYTEOR() FT_BYTEXOR() FT_BYTENEG() FT_BYTEAND()
FT_BYTENEG
FT_BYTENEG() Perform bit-wise negation on an ASCII character Syntax FT_BYTENEG( <cByte> ) -> cNewByte Arguments <cByte> is a character from CHR(0) to CHR(255). May be passed in CHR() form, as character literal, or as expression evaluating to CHR() value. Returns Returns resulting byte, in CHR() form. If parameters are faulty, returns NIL. Description Can be used for bit-wise byte manipulation. In effect, this is a bit-by-bit NEG (two's complement) operation. Equivalent to NEG assembler instruction. 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 performs a bit-wise NEG on byte represented by CHR(32): cNewByte := FT_BYTENOT(CHR(32)) ? asc(cNewByte) // result: 224 For a demonstration of Clipper bit manipulations, compile and link the program BITTEST.PRG in the Nanforum Toolkit source code. Source: BYTENEG.PRG Author: Forest Belt, Computer Diagnostic Services, Inc.
See Also: FT_BYTEOR() FT_BYTEXOR() FT_BYTENOT() FT_BYTEAND()
FT_BYTEAND
FT_BYTEAND() Perform bit-wise AND on two ASCII characters (bytes) Syntax FT_BYTEAND( <cByte1>, <cByte2> ) -> cByte Arguments <cByte1> and <cByte2> are characters from CHR(0) TO CHR(255). May be passed in CHR() form, as character literals, or as expressions evaluating to CHR() values. Returns Returns resulting byte, in CHR() form. If parameters are faulty, returns NIL. Description Can be used for any bit-wise masking operation. In effect, this is a bit-by-bit AND operation. Equivalent to AND assembler instruction. 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 would mask out the high nibble (four most significant bits) of the byte represented by chr(123) and leave the low nibble bits as in the parameter byte. cNewbyte := FT_BYTEAND( CHR(123), CHR(15) ) ? asc(cNewByte) // result: 11 ? cNewByte // result: non-printable character For a demonstration of Clipper bit manipulations, compile and link the program BITTEST.PRG in the Nanforum Toolkit source code. Source: BYTEAND.PRG Author: Forest Belt, Computer Diagnostic Services, Inc.
See Also: FT_BYTEOR() FT_BYTEXOR() FT_BYTENOT() FT_BYTENEG()