Hi All,
I have situation that I need to count the number of occurences of an specific word from a big string field.
Can anyone help me with this...?
Thanks
for perfomance and utilities you need use C# methode with Regex expression.
Also in ABL pure code , you mays try this
do i = 1 to num-entries (myvar," "):
if (entry(myvar,i," ") == myword) then j = j + 1.
end.
It all depends on the grammar... If words are allowed to follow a period or a comma, entry is going to fail. INDEX and LENGTH would be the functions of choice in this likely case.
Thanks Adrien and Mike,
I think I got this,
/*-------------------------------------------------------------------------------*/
DO WHILE TRUE:
IF INDEX (SourcText, WordToFind, Position) > 0 THEN
DO:
ASSIGN
Position = INDEX (SourcText, WordToFind, Position) + 1
Counts = Counts + 1.
END.
ELSE
LEAVE.
END.
DISP Counts.
/*-------------------------------------------------------------------------------*/
any suggestions..?
this would break with the following:
say that you are looking for the word "foo"
"foo this is more text foo. And this is foobar"
would return a count of three. But foobar is not foo
Julian
On 14 May 2012 10:39, Ithrees Asan Ishak