954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Find How Many Specific Char in Text

Hello All,

As the title..
Does any one know how to find how many specific character in a text?

Best Regard
Eko.

EkoX
Newbie Poster
18 posts since Aug 2008
Reputation Points: 28
Solved Threads: 1
 

Try This :
Text1 is filled by any text or words
Text2 is filled by char to find.

Private Sub Command1_Click()
    Dim CharCount, i As Integer
    CharCount = 0
    For i = 0 To Len(Text1.Text)
        Text1.SetFocus
        Text1.SelStart = i
        Text1.SelLength = 1
        If Text1.SelText = Text2.Text Then 
            CharCount = CharCount + 1 sesuai
        End If
    Next
    MsgBox "You have " & CharCount & " Character " & Text2.Text
End Sub
Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

Working like a charm..
Thank you for helping sir.

EkoX
Newbie Poster
18 posts since Aug 2008
Reputation Points: 28
Solved Threads: 1
 

Also this thread already solved.
Thanks once again.

EkoX
Newbie Poster
18 posts since Aug 2008
Reputation Points: 28
Solved Threads: 1
 

You're Welcome.
Happy Coding

Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: