|
-
Feb 28th, 2006, 10:02 AM
#1
Thread Starter
Member
[RESULVED] Tied up in Strings...
The code:
<code>
Const NumStrings As Integer = 10
Dim A(NumStrings) As String
Dim i As Integer, j As Integer, T As String
FillArrayFromFile(A, NumStrings, "FILE.EXT")
For i = 1 to NumStrings - 1
For J = i + 1 to NumStrings
If A(j) < A(i) Then
T = A(i)
A(i) = A(j)
A(j) = T
End If
Next j
Next i
</code>
results in some strings in A being duplicated at the expense of others.
I presume that expressions such as T = A(i) and A(i) = A(j) are implementd by moving a pointer to the actual string, because if I replace them with something like T = Mid(A(i), 1, Len(A(i)) the problem goes away. It is very inelegant, however. Is there a simpler, more direct way to accomplish this?
Why did MS do this to us programmers? They went to great lengths to extend Object Oriented concepts throughout the language, add great exception handling, fix a large number of problems from VB5/6, and then muck about with simple substitution. Sigh.
RussCanada
Last edited by RussCanada; Feb 28th, 2006 at 10:33 AM.
Reason: Add [RESOLVED] to title
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|