If you ask me the set back with the dictionary method is that they are not case sensitive, also while comparing stings. For example if you have “World” or “world” than they will look the same. For removing the case sensitive’s try the following:
Code:
Function RemoveDuplicates(s() as String, isCaseSensitive as Boolean = true) As String()
dim returnString() as String
//We know we want the first one, so append it to returnString
returnString.Append s(0)
//Loop through all the values in the input array
//and compare them to our returnString
//If it exists, don't append it
for i as Integer = 1 to s.Ubound
dim exists as Boolean = false
for j as Integer = 0 to returnString.Ubound
if isCaseSensitive then
//If we want the comparison to be case sensitive, use StrComp
//("Hello"="hello" returns nonzero)
if StrComp(s(i), returnString(j), 1) = 0 then
exists = true
exit for //we don't need to keep looping through returnString, we already found a match
end if
else
//Comparing text with = is not case sensitive (so "Hello"="hello" returns true)
if s(i) = returnString(j) then
exists = true
exit for //we don't need to keep looping through returnString, we already found a match
end if
end if
next
//If we didn't find a match, append the original value to returnString
if exists = false then
returnString.Append s(i)
end if
next
Return returnString()
End Function
Bookmarks