I haven't tested this for speed or unexpected conditions, but... $a:="now is the timetime for all good men to come to the aid of their country" $l1:=Length($a)
$b:="time" $lb:=Length($b) $a:=Replace string($a;$b;"";*) $l2:=Length($a) $l3:=$l1-$l2/$lb ALERT(String($l3)) Keith - CDI > On May 4, 2017, at 7:22 AM, Jörg Knebel via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > Hi all > > I’m wondering if someone has a clever routine to count the number of > appearances of a specific character/word in a string/text and is willing to > share it. > > Thanks > > Cheers > Jörg > > > ********************************************************************** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: http://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:4d_tech-unsubscr...@lists.4d.com > ********************************************************************** ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **********************************************************************