Determining number of occurrences

Andrew Stolarz stolarz at gmail.com
Fri Dec 19 19:08:48 EST 2014


Jean Marc & Doug,

Thanks for the tips!


Cheers,

Andrew


On 19 December 2014 at 14:03, Doug Easterbrook <doug at artsman.com> wrote:

> hi Andrew/Jean Marc
>
>
> Jan Marc's solution is good for single characters -- fails if you are
> looking for patterns like   --* or such.
>
> TMobjs external (again free) has a replace function where one of the
> parameters is the number of times the replacement happened.
>
> makes it generic.
>
>
> or change JM's solution to
>
>
> template = '--*'
> Calculate OccNb as len(Mystring)-len(replaceall(Mystring,
> template,'')*length(template)
>
>
>
> Doug Easterbrook
> Arts Management Systems Ltd.
> mailto:doug at artsman.com
> http://www.artsman.com
> Phone (403) 536-1205    Fax (403) 536-1210
>
> > On Dec 19, 2014, at 11:34 AM, Jean Marc Azerad <azerad.jm at wanadoo.fr>
> wrote:
> >
> > Calculate OccNb as len(Mystring)-len(replaceall(Mystring,'.','')
> >
> > Not tried but should work...
> >
> >
> >
> >> Le 19 déc. 2014 à 18:59, Andrew Stolarz <stolarz at gmail.com> a écrit :
> >>
> >> Hello,
> >>
> >> What is the best way to determine the number of occurrences within a
> string?
> >>
> >> ie. count number of times a period '.' is in a string.
> >>
> >>
> >>
> >> Andrew
> >> _____________________________________________________________
> >> Manage your list subscriptions at http://lists.omnis-dev.com
> >
> > _____________________________________________________________
> > Manage your list subscriptions at http://lists.omnis-dev.com
>
>
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
>
>



More information about the omnisdev-en mailing list