Below is my coding for the counting of sentences in a paragraph of inputted text. So far though i can only get it to count full stops (eg. however many full stops there are there are sentences.). What if i had a question mark though, because that would be the end of a sentence too???? so how do i include question marks in the code below to count question marks AND full stops. (eg. however many full stops AND question marks there are sentences).
hope u caught my drift!!
VB Code:
Private Sub cmdsentences_Click() Dim Sentence As String, Char As String Dim Count As Integer, I As Integer Count = 0 Sentence = Trim(txtInput.Text) If Len(Sentence) > 0 Then For I = 1 To Len(Sentence) Char = Mid(Sentence, I, 1) If Char = "." Then Count = Count + 1 End If Next I Count = Count End If lblCountsentences.Caption = Count End Sub




Reply With Quote