norrodj
asked on
Counting characters, words and paragraphs in a text file or from a textbox.
I'm getting an error that StringType.Strcmp isn't declared. Can someone please tell me where I'm going wrong?
Public Property StringContents() As String
Get
Return mstrString
End Get
Set(ByVal Value As String)
pintCharacters = 0
pintWords = 0
pintSentences = 0
pintParagraphs = 0
mstrString = Value
Dim text2 As String = Value
Dim num2 As Integer = text2.Length
If (num2 > 0) Then
pintWords += 1
End If
Dim num3 As Integer = (num2 - 1)
Dim num1 As Integer = 0
Do While (num1 <= num3)
pintCharacters += 1
Dim text1 As String = text2.Substring(num1, 1)
If (StringType.StrCmp(text1, " ", False) = 0) Then
pintWords += 1
End If
If (StringType.StrCmp(text1, ChrW(9), False) = 0) Then
pintWords = (pintWords + pintWords)
End If
If (StringType.StrCmp(text1, ".", False) = 0) Then
pintSentences += 1
End If
If (StringType.StrCmp(text1, ChrW(10), False) = 0) Then
pintParagraphs += 1
End If
num1 += 1
Loop
End Set
End Property
Public Sub OpenFile(ByVal pstrFileName As String)
Dim reader1 As New StreamReader(pstrFileName)
pintCharacters = 0
pintWords = 0
pintSentences = 0
pintParagraphs = 0
Dim text2 As String = reader1.ReadLine
Do While (StringType.StrCmp(text2, Nothing, False) <> 0)
pintParagraphs += 1
Dim num2 As Integer = text2.Length
pintWords += 1
Dim num3 As Integer = (num2 - 1)
Dim num1 As Integer = 0
Do While (num1 <= num3)
pintCharacters += 1
Dim text1 As String = text2.Substring(num1, 1)
If (StringType.StrCmp(text1, " ", False) = 0) Then
pintWords += 1
End If
If (StringType.StrCmp(text1, ChrW(9), False) = 0) Then
pintWords += 1
End If
If (StringType.StrCmp(text1, ".", False) = 0) Then
pintSentences += 1
End If
num1 += 1
Loop
mstrString = (mstrString & text2)
text2 = reader1.ReadLine
Loop
End Sub
Public Property StringContents() As String
Get
Return mstrString
End Get
Set(ByVal Value As String)
pintCharacters = 0
pintWords = 0
pintSentences = 0
pintParagraphs = 0
mstrString = Value
Dim text2 As String = Value
Dim num2 As Integer = text2.Length
If (num2 > 0) Then
pintWords += 1
End If
Dim num3 As Integer = (num2 - 1)
Dim num1 As Integer = 0
Do While (num1 <= num3)
pintCharacters += 1
Dim text1 As String = text2.Substring(num1, 1)
If (StringType.StrCmp(text1, " ", False) = 0) Then
pintWords += 1
End If
If (StringType.StrCmp(text1, ChrW(9), False) = 0) Then
pintWords = (pintWords + pintWords)
End If
If (StringType.StrCmp(text1, ".", False) = 0) Then
pintSentences += 1
End If
If (StringType.StrCmp(text1, ChrW(10), False) = 0) Then
pintParagraphs += 1
End If
num1 += 1
Loop
End Set
End Property
Public Sub OpenFile(ByVal pstrFileName As String)
Dim reader1 As New StreamReader(pstrFileName)
pintCharacters = 0
pintWords = 0
pintSentences = 0
pintParagraphs = 0
Dim text2 As String = reader1.ReadLine
Do While (StringType.StrCmp(text2, Nothing, False) <> 0)
pintParagraphs += 1
Dim num2 As Integer = text2.Length
pintWords += 1
Dim num3 As Integer = (num2 - 1)
Dim num1 As Integer = 0
Do While (num1 <= num3)
pintCharacters += 1
Dim text1 As String = text2.Substring(num1, 1)
If (StringType.StrCmp(text1, " ", False) = 0) Then
pintWords += 1
End If
If (StringType.StrCmp(text1, ChrW(9), False) = 0) Then
pintWords += 1
End If
If (StringType.StrCmp(text1, ".", False) = 0) Then
pintSentences += 1
End If
num1 += 1
Loop
mstrString = (mstrString & text2)
text2 = reader1.ReadLine
Loop
End Sub
What does the StringType class look like and where do you define it in your code?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.