Results 1 to 4 of 4

Thread: Changing a string

  1. #1
    Guest

    Post Changing a string

    Ok, this is the string i have...

    http://www.geocities.com/jeb_malice/frame.html

    and i need it to turn into this...

    http://www.geocities.com/jeb_malice/

    but...

    The string could also be this...

    http://www.geocities.com/jeb_malice/list.js

    and that would have to be turned into...

    http://www.geocities.com/jeb_malice/

    If i didnt explain this right, let me know. If i did explain it right, try to answer!


  2. #2
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    This is my area of expertise actually. String manipulation.

    Code:
        Dim ip As Long
        Dim strtocheck As String
    
        strtocheck = "http://www.geocities.com/jeb_malice/frame.html"
        
        'find the last /
        ip = InStrRev(strtocheck, "/")
        'get everything upto and including the last /
        strtocheck = Left$(strtocheck, ip)
        
        MsgBox strtocheck
    Iain, thats with an i by the way!

  3. #3
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516

    I'd just like to add to that...

    [/code]
    Dim ip As Long
    Dim StrX As String

    StrX = Text1.Text

    If StrX Like "http://www.geocities.com/jeb_malice/*.*" Then
    'This is just Iain's code (with my variable):
    ip = InStrRev(StrX, "/")
    'get everything upto and including the last /
    StrX = Left$(StrX, ip)
    MsgBox StrX
    End If
    [/code]

    I'm not good at String Manipulation, but it's my best area if you see
    what Slim Shady is saying.
    Courgettes.

  4. #4
    Guest
    Thanks i think i got it working now.

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