Troitsky
Водник Водкин | Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору Код: Private Type Table Word As String Count As Integer End Type Public Function HowMuch(ByVal strSource As String, ByVal strWord As String) As Integer Dim intPos As Integer Dim intCounter As Integer strSource = Space(1) & strSource & Space(1) strWord = Space(1) & Trim(strWord) & Space(1) intPos = 0 intCounter = 0 Do intPos = InStr(strSource, strWord) If intPos > 0 Then intCounter = intCounter + 1 strSource = Space(1) & Trim(Left(strSource, intPos - 1) & Right(strSource, Len(strSource) - intPos - Len(strWord) + 2)) & Space(1) End If Loop Until intPos = 0 HowMuch = intCounter End Function Private Sub Form_Load() Dim CountList() As Table Dim intPos As Integer Dim strSource As String Dim strWord As String Dim i As Integer ' счетчик ReDim CountList(0) strSource = "123 при вал приз упри п ри при прии при пре " strSource = Trim(strSource) Do intPos = InStr(strSource, " ") If intPos > 0 Then strWord = Left(strSource, intPos-1) CountList(UBound(CountList)).Word = strWord CountList(UBound(CountList)).Count = HowMuch(strSource, strWord) strSource = Space(1) & strSource & Space(1) strWord = Space(1) & Trim(strWord) & Space(1) strSource = Trim(Replace(strSource, strWord, " ")) & Space(1) End If If strSource = Space(1) Then Exit Do Else ReDim Preserve CountList(UBound(CountList) + 1) End If Loop For i = 0 To UBound(CountList) MsgBox CountList(i).Word & Space(10) & CountList(i).Count Next i End Sub | | Всего записей: 795 | Зарегистр. 13-12-2003 | Отправлено: 13:52 09-12-2005 | Исправлено: Troitsky, 14:09 09-12-2005 |
|