Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: inStr

  1. #1
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,096
    Thanks
    15
    Thanked 1 Time in 1 Post

    Angry inStr

    Code:
    if inStr(selection,",") <> "0" then
    instring = inStr(selection,",")
    selection = left(selection, len(selection)-selection-1)
    end if
    selection's value is 'Denver, CO'

    How do i cut it up to be just 'Denver'

  • #2
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,096
    Thanks
    15
    Thanked 1 Time in 1 Post
    if inStr(selection,",") <> "0" then
    instring = inStr(selection,",")
    length = len(selection)
    selection = left(selection, instring-1)
    end if

  • #3
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Why not just use Split()
    Code:
    <%
    Dim selection
    selection = "Denver, CO"
    
    Response.Write getVal(selection)
    
    Private Function getVal(ByVal str)
    	Dim arr
    	arr = Split(str, ",")
    
    	getVal = arr(0)
    End Function
    
    %>


  •  

    Posting Permissions

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