Results 1 to 5 of 5
  1. #1
    Join Date
    May 2003
    Posts
    19

    Unanswered: Split and strings

    I've been trying to get the Split function to chop off urls at the first slash after dot-com or co-dot-uk etc. In other words, to make the url - I have miles of them to do this to - as short as possible yet still usable.

    I have been trying in a variety of queries, all with no success. Has anyone done this before please and know what works? cheers

    kupe

  2. #2
    Join Date
    Mar 2003
    Location
    Romania
    Posts
    32
    Assuming that you have a table (Table1) with a text field (url) you can use this query:

    SELECT Table1.url, InStr([url],"://") AS Pos1, Mid([url],IIf([Pos1],[Pos1]+3,1),Len([url])) AS url1, InStr([url1],"/") AS Pos2, IIf([Pos2],Left([url1],[Pos2]-1),[Url1]) AS ShortUrl
    FROM Table1;

    In my table I have three records:

    http://www2.omnitel.net/smirlis/tmp/schule.html
    www2.omnitel.net/smirlis/tmp/schule.html
    www2.omnitel.net

    The result is in column ShortUrl of the above query like this:
    ShortUrl
    www2.omnitel.net
    www2.omnitel.net
    www2.omnitel.net

    Note. In the end you may go on page: http://www2.omnitel.net/smirlis/tmp/schule.html (is very funny).

    Hopping that this is what you wanted,
    Florin Profeanu
    floreanuprofin@yahoo.com

  3. #3
    Join Date
    May 2003
    Posts
    19
    Looks very good, Florin. Really grateful.

  4. #4
    Join Date
    May 2003
    Posts
    19
    Very good, Florin, only it isn't working in my query. Just in case, I've tried it as qbe and sql, and anything else I can think of. Be grateful for a little more instruction on how you use it.
    Your site is very good, and much chuckling. Cheers.

  5. #5
    Join Date
    May 2003
    Posts
    19
    Sorry, Florin, my (stupid) mistake, sorry. Going perfectly, of course. It's a very handy piece of code and works really well. Really grateful.

Posting Permissions

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