Re: [Gambas-user] Counting characters

2011-11-13 Thread nando
:58:17 +0100 Subject: Re: [Gambas-user] Counting characters maybe with gb.pcre : regexp or Public Function CountChar(sValue as string, sChar as string) as integer dim i, iRet as integer for i =1 to len (sValue)+1 if mid(sValue,i,1)=sChar then inc iRet next return iRet end print

Re: [Gambas-user] Counting characters

2011-11-13 Thread Fabien Bodard
-user@lists.sourceforge.net Sent: Fri, 11 Nov 2011 15:58:17 +0100 Subject: Re: [Gambas-user] Counting characters maybe with gb.pcre : regexp or Public Function CountChar(sValue as string, sChar as string) as integer dim i, iRet as integer for i =1 to len (sValue)+1   if mid(sValue,i,1

[Gambas-user] Counting characters

2011-11-11 Thread Rolf-Werner Eilert
Hi all, just a short question: Is there a function which simply counts how many times a character appears within a string? I vaguely remember a long time ago I used such a thing, but it may as well have been in another context. The only way I have found yet was using Split() and then count

Re: [Gambas-user] Counting characters

2011-11-11 Thread Fabien Bodard
maybe with gb.pcre : regexp or Public Function CountChar(sValue as string, sChar as string) as integer dim i, iRet as integer for i =1 to len (sValue)+1 if mid(sValue,i,1)=sChar then inc iRet next return iRet end print CountChar(coucou ça va ?, a) $ 2 Or a super version thet remember a