2
I want to know how many times you leave a string
appears within a text, example:
In the Microsoft quality is prioritized, therefore the Microsoft is the best.
I want a function in which I pass two parameters and return how many times the first parameter occurs in the second.
Something like:
ContarOcorrencias('Microsoft',TextoOriginal)
Must return 2 (two occurrences of the word Microsoft).
I have some ideas on how to set up the function, but I wanted to see if there is something native or the best way to create it.
He did not specify which version of
Delphi
was using, if the one he’s using isDelphi 7
for example, this option will not work.– Roberto de Campos
Exactly why I have already posted a more up-to-date answer, which doesn’t use so much the processor! As the tag is
delphi
, I didn’t cling to details!– Junior Moreira
Only it is not necessary to underestimate all other answers, since yours does not meet all possibilities.
– Roberto de Campos
There was no disregard my dear, the purpose here is always to answer! And based on something, if you wish to follow the subject, please call in Chat!
– Junior Moreira