Count one character's occurrences


Count the number of occurrences of a certain character in a string.

function count pChar, pString
    local tNumItems

    set the itemdel to pChar
    put num of items of pString into tNumItems

    if pString ends with pChar then
        return tNumItems
				
    else if tNumItems is not 0 then
        return tNumItems - 1
				
    else
        return 0
    end if
end count


FerrusLogic is it!

Payeer