as simple as
n = Tally(txt, Any "AoBiI" )
to count single chars or continuing occurences in same order you also could "abuse" ParseCount-function.
subtract 1 since the result usually tells the count of text-parts delimited by the passed chars
Uses "Console"
String txt = "Hello World from ThinBASIC!"
PrintL txt & $CRLF
PrintL "Tally ""ThinBASIC!"" = ", Str$(Tally(txt, "ThinBASIC!"))
PrintL "Tally Any ""ThinBASIC!"" = ", Str$(Tally(txt, Any "ThinBASIC!"))
PrintL "Parsecount ""ThinBASIC!"" - 1 = ", Str$(ParseCount(txt, "ThinBASIC!" )-1)
PrintL $CRLF & "key to end"
WaitKey
Bookmarks