CountChars

Top  Previous  Next

Prototype

 

intNumber:=CountChar(strTarget,strChars);

 

Description

 

Count character occurrence into the string.

 

Parameters

 

strTarget: value representing the input string

 

strChar: string representing the single character .

 

Returned Value

 

intNumber: occurrence counter

 

Notes

 

Be careful to Count.

 

Example

 

//It sets a string variable

StrInit:='MAMMA';

 

//It counts the character occurrence

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

 

//It logs counter value

ApplicationLog('The substring MA occur: '+IntToStr(Occurrence)); // 5 - there are five occurrence of M and A characters