Count

Top  Previous  Next

Prototype

 

intNumber:=Count(strTarget,strSubString);

 

Description

 

Count substring occurrence into a string.

 

Parameters

 

strTarget: value representing the input string

 

strSubString: substring value

 

Returned Value

 

intNumber: occurrence counter

 

Notes

 

Be careful to CountChars.

 

Example

 

//It sets a string variable

StrInit:='MAMMA';

 

//It counts the substring occurrence

Occurrence:=Count(StrInit,'MA');

 

//It logs counter value

ApplicationLog('The substring MA occur '+IntToStr(Occurrence)); // 2 - There are only two substring