Results 1 to 15 of 15

Thread: [RESOLVED] Remove double String from a String

Hybrid View

  1. #1
    PowerPoster Code Doc's Avatar
    Join Date
    Mar 2007
    Location
    Omaha, Nebraska
    Posts
    2,354

    Re: Remove double String from a String

    This does it. Add a command button to a form and then click on it after adding this code:
    Code:
    Private Sub Command1_Click()
    Dim Str1 As String, Str2 As String
    Str1 = "steve.K=T:qbe.K=T:qbe.K=T:qbe.K=T:"
    Str2 = "987654321_qn?K.X1_qn?K.X1_qn?K.X1_"
    Str1 = Left$(Str1, InStr(Str1, ".") - 1)
    Str2 = Left$(Str2, InStr(Str2, "_") - 1)
    MsgBox Str1 & vbCrLf & Str2
    End Sub
    Doctor Ed

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    530

    Re: Remove double String from a String

    Quote Originally Posted by Code Doc View Post
    This does it. Add a command button to a form and then click on it after adding this code:
    Code:
    Private Sub Command1_Click()
    Dim Str1 As String, Str2 As String
    Str1 = "steve.K=T:qbe.K=T:qbe.K=T:qbe.K=T:"
    Str2 = "987654321_qn?K.X1_qn?K.X1_qn?K.X1_"
    Str1 = Left$(Str1, InStr(Str1, ".") - 1)
    Str2 = Left$(Str2, InStr(Str2, "_") - 1)
    MsgBox Str1 & vbCrLf & Str2
    End Sub
    hmm Thanks ,
    but i think you didnt understand me good cause i cant use only . or _ everytime i can have different string so i should make it dynamic
    here you other example

    Code:
    brad123]slI,Z3]slI,Z3]slI,Z3] 
    12345~mj!D2[5~mj!D2[5~mj!D2[5~mj
    steve.K=T:qbe.K=T:qbe.K=T:qbe.K=T:
    987654321_qn�K.X1_qn�K.X1_qn�K.X1_
    
    must be like 
    brad123
    12345
    steve
    987654321
    Thanks cause i really tried to get an algo for that but i couldnt get it

  3. #3
    PowerPoster Code Doc's Avatar
    Join Date
    Mar 2007
    Location
    Omaha, Nebraska
    Posts
    2,354

    Re: Remove double String from a String

    If the delimiter character changes continuously from one string to the next, then you are a dead duck because there is no consistency.
    Doctor Ed

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    530

    Re: Remove double String from a String

    Quote Originally Posted by Code Doc View Post
    If the delimiter character changes continuously from one string to the next, then you are a dead duck because there is no consistency.
    yes but i was studying the output and found that the other string that i wanna remove come as double are same
    look in this example
    Code:
    brad123]slI,Z3]slI,Z3]slI,Z3]
    Now the true string is : brad123
    next it come a serie of 3 doube of string ]slI,Z3]..

    brad123]slI,Z3]slI,Z3]slI,Z3]
    1 2 3
    as you see the double are the same

    brad123 ]slI,Z3 ]slI,Z3 ]slI,Z3]
    'true str 1 double 2 double 3 double


    what do you think ?

    Thanks

  5. #5
    PowerPoster Code Doc's Avatar
    Join Date
    Mar 2007
    Location
    Omaha, Nebraska
    Posts
    2,354

    Re: Remove double String from a String

    Killer7k said, "what do you think?"
    -------------
    I think that you should mark your thread Resolved using the thread tools.
    Doctor Ed

Posting Permissions

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



Click Here to Expand Forum to Full Width