View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_377_] Leith Ross[_377_] is offline
external usenet poster
 
Posts: 1
Default Compare data strings?


Hello Ed,

This routine scans a string character by character and stores the
number of times the character is found in an array. The array has 256
elements, one for each ASCII value. The result is a final string that
will contain the unique characters found. A unique character is one
that appears only once.


Code:
--------------------

Sub FindUniqueCharacters()

Dim Chars(255) As Integer
Dim N As Integer
Dim TestStr As String

TestStr = "ABCDEFABCDeF"

For I = 1 To Len(TestStr)
N = Asc(Mid(TestStr, I, 1))
Chars(N) = Chars(N) + 1
Next I

For I = 0 To 255
If Chars(I) = 1 Then
S = S & Chr$(I)
End If
Next I

End Sub

--------------------


Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=493209