Get the amount of a specific character in a string

If you have completed an application and wish to share the complete source/project files with everyone then please post it in here. Source-code files only, no tutorials.
11 posts Page 1 of 2
Contributors
User avatar
Cheatmasterbw
Coding God
Coding God
Posts: 1506
Joined: Fri Jan 01, 2010 2:30 pm

this code gets the amount of a specific character in a string

e.g.
CharCount("Apple", "p") will return 2
Code: Select all
Function CharCount(ByVal iStr As String, ByVal iChar As String)
    Dim iCount As Integer = 0
    For i = 0 To iStr.Length - 1
        If iStr.Chars(i) = iChar Then iCount += 1
    Next
    Return iCount
End Function
http://www.megaapps.tk/
User avatar
XTechVB
VIP - Site Partner
VIP - Site Partner
Posts: 727
Joined: Thu May 20, 2010 10:32 am

you've posted this 2 times
You can find me on Facebook or on Skype mihai_92b
User avatar
Cheatmasterbw
Coding God
Coding God
Posts: 1506
Joined: Fri Jan 01, 2010 2:30 pm

where??
http://www.megaapps.tk/
User avatar
XTechVB
VIP - Site Partner
VIP - Site Partner
Posts: 727
Joined: Thu May 20, 2010 10:32 am

Cheatmasterbw wrote:
where??
sorry i didn't read wright now i've seen that 1 tut is about the amount of a character in a string an the other is about the most common character in a string.
I'm Sorry
You can find me on Facebook or on Skype mihai_92b
User avatar
Cheatmasterbw
Coding God
Coding God
Posts: 1506
Joined: Fri Jan 01, 2010 2:30 pm

its fine.
http://www.megaapps.tk/
User avatar
zachman61
VIP - Donator
VIP - Donator
Posts: 1892
Joined: Wed Dec 16, 2009 9:56 pm

thanks Cheatmaster :D
cooll;
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that :)
Lewis
Coding God
Coding God
Posts: 1564
Joined: Sun Dec 20, 2009 2:12 pm

This works but should be in quick snips
Image
User avatar
Cheatmasterbw
Coding God
Coding God
Posts: 1506
Joined: Fri Jan 01, 2010 2:30 pm

zachman: your welcome
Lewis-Froom: i think this is source code in a way.
http://www.megaapps.tk/
User avatar
Agust1337
Coding God
Coding God
Posts: 2456
Joined: Fri Feb 19, 2010 8:18 pm

cool i always wanted to know it, but havent got the time to ask if any1 had it xD Thanks for sharing Cheatmasterbw cooll;
Top-notch casual Dating
User avatar
Cheatmasterbw
Coding God
Coding God
Posts: 1506
Joined: Fri Jan 01, 2010 2:30 pm

your welcome!
http://www.megaapps.tk/
11 posts Page 1 of 2
Return to “Source-Code”