Finding characters in a VBA or VFP string
VBA
Instr(), InstrRev()
VFP
At(), AtC(), AtCC(), Rat(), Occurs()
Notes
The simple functions Instr() and At() return the position of one string
within another. Be aware that the order of the parameters is reversed in
the two languages. Both these examples will return the value 5.
pos = Instr("ABCDEFGH", "E")
pos = At("E", "ABCDEFGH")
Both languages will return 0 if the target can't be found. In VBA
the search is case-insensitve, in VFP the search is case-sensitive.
Use the AtC() function in VFP for a case-insensitive search.
Both languages have related commands which will search backwards from
the end of the string or pick up a particular instance of the target.
Again there is a source of confusion in the syntax. VBA lets you start
from the nth character in the string being searched, VFP lets you
find the nth occurrence of the target.
VFP's Occurs() function counts the number of times that a character
occurs in another string.
Trimming spaces
|
Text functions
|
Changing Case
|