|
-
Aug 9th, 2009, 07:49 AM
#9
Thread Starter
Fanatic Member
Re: Remove double String from a String
 Originally Posted by Billy Conner
well i worked on it a bit. my instinct tells me i need to work from the right side of the string to the left to get true results but i haven't gotten it to work that way. this code here doesn't follow that pattern but it seems to work so far. from the way it's made i don't really see it being faultless, but you can check it out to see how it works out for you.
Code:
Private Function RemoveExtra(pStr As String) As String
Dim Pos As Long, Cnt As Long, pLen As Long
Dim Data() As String, mStr As String
Pos = 1
pLen = 4
Cnt = 0
Do Until Pos = Len(pStr)
mStr = Mid$(pStr, Pos, pLen)
Data() = Split(pStr, mStr)
If UBound(Data) >= 3 Then
Cnt = Cnt + 1
pLen = pLen + 1
Else
If Cnt Then
RemoveExtra = Left$(pStr, InStr(pStr, mStr))
Exit Do
Else
Pos = Pos + 1
End If
End If
Loop
End Function
edit: to call it just do something like MyRetStr = RemoveExtra(FullStr)
Thanks m8 your function work really good 
it helped me a lot of and got my life easier with that
@koolsid,
Thanks m8 but seem Billy Conner function working good
Thanks again and cheerz
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
|