def var lcFileContent as longchar no-undo.
def var cStringToFind as character no-undo.
def var iCount as integer no-undo.
assign
lcFileContent = "how many times can we find the 'an' string in this sentance?"
cStringToFind = "an"
iCount = 0.
do while index(lcFileContent,cStringToFind) > 0:
assign
substring(lcFileContent,index(lcFileContent,cStringToFind),length(cStringToFind)) = ""
iCount = iCount + 1.
end.
message iCount.