A CountChar - Better than looping through a string!!!
It used to be, when I wanted to count the number of times a charector appeared in a string, I would loop through the string letter by letter and keep a count. I have replace my old methodolgies with this one, which also allows you to search for substrings (more than 1-digit long)
AI
Resumen de IA: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Código fuente
<BR><BR>Public Function CountChar(vText as String, vChar as String, Optional IgnoreCase as Boolean) as Integer<BR> If IgnoreCase Then <BR> vText = LCase$(vText) <BR> vChar = LCase$(vChar) <BR> End If <BR> Dim L as Integer <BR> L = Len(vText) <BR><BR> vText = Replace$(vText, vChar, "") <BR> CountChar = (L - Len(vText)) / Len(vChar) <BR> End Function
Comentarios originales (3)
Recuperado de Wayback Machine