Determine the string is repeating in the array

# Thread: Determine the string is repeating in the array

1. sr
Member
Join Date
Dec 1969
Posts
55

## Determine the string is repeating in the array

Hi<BR>I need to determining whether a string is repeating and get the id, and Return a indication strLookingFor is repeating in aTable1Values how to do?<BR>dim aTable1Values<BR>aColumValues = objRecordset.GetRows(, ,Array("emp_ID","fDateLeave"))<BR>Do Until objRecordset.EOF<BR> name_ID = objRecordset.Fields("emp_ID")<BR> sDate = objRecordset.Fields("fDateLeave")<BR><BR>Function isStringRepeat(aColumValues, sDate, compare)<BR> Dim iUpper, iLoop<BR> iUpper = UBound(aColumValues)<BR> For iLoop = LBound(aColumValues) to iUpper<BR> If compare = vbTextCompare then<BR> If CStr(UCase(aColumValues(iLoop))) = CStr(UCase(sDate)) then<BR> PositionInArray = iLoop<BR> Exit Function<BR> End If<BR>(here I am getting error too)<BR> &#039;Else If CStr(aColumValues(iLoop)) = CStr(sDate) then<BR> &#039;isStringRepeat = iLoop<BR> &#039;Exit Function<BR> End If<BR> &#039;End If<BR>Next<BR><BR>End Function

2. Senior Member
Join Date
Dec 1969
Posts
1,913

## RE: Determine the string is repeating in the array

Here&#039;s an easy way to see if a string is repeated in another one:<BR><BR>MyStr="Blah yackblahbalhshfsdjfhjfsdh csdcd blah"<BR>MyArray=Split(Ucase(MyStr),"BLAH")<BR>Res ponse.Write("Blah occurs " & Ubound(MyArray) & " times in the string: " & MyStr<BR><BR>Hope this helps

3. sr
Member
Join Date
Dec 1969
Posts
55

## RE: Determine the string is repeating in the array

it is giving you the value but I need to get a value from the table colum and test that array with a variable value

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•