Используйте этот код, и нет необходимости в функции runOnUiThread
:
private Handler handler;
private Runnable handlerTask;
void StartTimer(){
handler = new Handler();
handlerTask = new Runnable()
{
@Override
public void run() {
// do something
textView.setText("some text");
handler.postDelayed(handlerTask, 1000);
}
};
handlerTask.run();
}
Фильтр вернет любые элементы, которые частично совпадают. Работа, предложенная Microsoft, заключается в том, чтобы затем искать фильтрованный массив для точных совпадений.
Function FilterExactMatch(astrItems() As String, _
strSearch As String) As String()
' This function searches a string array for elements
' that exactly match the search string.
Dim astrFilter() As String
Dim astrTemp() As String
Dim lngUpper As Long
Dim lngLower As Long
Dim lngIndex As Long
Dim lngCount As Long
' Filter array for search string.
astrFilter = Filter(astrItems, strSearch)
' Store upper and lower bounds of resulting array.
lngUpper = UBound(astrFilter)
lngLower = LBound(astrFilter)
' Resize temporary array to be same size.
ReDim astrTemp(lngLower To lngUpper)
' Loop through each element in filtered array.
For lngIndex = lngLower To lngUpper
' Check that element matches search string exactly.
If astrFilter(lngIndex) = strSearch Then
' Store elements that match exactly in another array.
astrTemp(lngCount) = strSearch
lngCount = lngCount + 1
End If
Next lngIndex
' Resize array containing exact matches.
ReDim Preserve astrTemp(lngLower To lngCount - 1)
' Return array containing exact matches.
FilterExactMatch = astrTemp
End Function
Этот код взят из http://msdn.microsoft.com/en-us/library /office/aa164525%28v=office.10%29.aspx
Если массив используется только для этого сравнения и не нужен ни для чего другого, вы также можете принудительно выполнить полное сравнение слов, добавив свои собственные разделители, которые никогда не появляются в данных - возможно, квадратные скобки. Поэтому, если вы измените свой массив на «[mally]», «[kate]», «[becks]», тогда ваше условие станет:
If UBound(Filter(myArray, "[" & Sheets(i).Cells(1, j).Value & "]", True)) = -1
IsInArray = Not IsError(Application.Match(stringToBeFound, arr, 0))
Если вам не нужно использовать фильтр, то снимок будет работать
Dim v
Dim bMatch As Boolean
bMatch = False
For Each v In myArray
'compare strings
If StrComp(CStr(v), Sheets(i).Cells(1, j).Value, vbTextCompare) = 0 Then
bMatch = True
End If
Next
If Not bMatch Then
'do something
End If