473,326 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Trimming filename and paramters from a URL (output from DB)

Hi there.

I seem to be a flurry of questions here recently, thanks for you help all,
but ... got another question here.

I am storing URL in a database for a 'sort of' directory type website.

The <a href> is built from the recordset of URL's which is all working no
problem, easy stuff.

What I have found is going to be necessary in some cases is to trim the URL
back to just it's www.abc.co.uk address for the link display.

I still want the actual link to go to it's long 'deep linking' location, but
there is limited room for displaying a URL that could be a hundred chars
long.

So... Just to recap.

http://www.abc.co.uk/products.asp?ca...methingelse=12

gets trimmed back to

www.abc.co.uk

Thanks in advance.

Simon.
Jul 21 '05 #1
2 1362
I got ;-)

I realised I was trimming the http:// from the inputted URL, so I only had
to search for the first / and stop there.

<%

if not rs("URL")="" then

iURL = instr(rs("URL"), "/")
if iURL then tURL = left(rs("URL"), iURL-1) else tURL = rs("URL")
fURL = tURL
%><strong>Website</strong> : <a href="http://<%= rs("URL") %>"
title="<%= fURL %>"><%= fURL %></a><br /><% end if %>

Take care

Si
"Simon" <si*************@blueyonder.co.uk> wrote in message
news:xo*********************@fe2.news.blueyonder.c o.uk...
Hi there.

I seem to be a flurry of questions here recently, thanks for you help all,
but ... got another question here.

I am storing URL in a database for a 'sort of' directory type website.

The <a href> is built from the recordset of URL's which is all working no
problem, easy stuff.

What I have found is going to be necessary in some cases is to trim the URL back to just it's www.abc.co.uk address for the link display.

I still want the actual link to go to it's long 'deep linking' location, but there is limited room for displaying a URL that could be a hundred chars
long.

So... Just to recap.

http://www.abc.co.uk/products.asp?ca...methingelse=12

gets trimmed back to

www.abc.co.uk

Thanks in advance.

Simon.

Jul 21 '05 #2
Simon wrote on 28 okt 2004 in microsoft.public.inetserver.asp.general:
trimming the http:// from the inputted URL

fURL = replace(rs("URL"),"http://","/")

or

fURL = replace(rs("URL"),"http:/","")

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Generic Usenet Account | last post by:
I have worked out the following implementation for trimming the leading and trailing whitespace characters of a string (I am surprised not to see these as member functions). Am I doing it...
7
by: ColinWard | last post by:
Hello. I use the following line which returns the path of a file and adds it to a listbox. How can I modify this line so that it only returns the filename and not the entire path? -->...
5
by: Brian Henry | last post by:
I have a messaging application that has a data grid with information like an email list would have (from, subject, time sent, size) but the subject could be very long in theory, and then it would...
10
by: Brian Gruber | last post by:
Hi, I'm looking for a way to rename a whole directory of files in short order. The files in the directory have different lengths, however all of them end with _xxxx the x's represent a randomly...
0
by: Paul | last post by:
On my local site, I have a folder that is security trimmed, so that only members of a Role can see it after they register and log on (I set the memberships). All works fine locally. However,...
4
by: B Squared | last post by:
I'm trying to pass a filename (which is a jpeg image) to a php function / file so that it will display. I know that its simple to get PHP to display an image hardcoding in the filename. For...
8
by: PvtPile | last post by:
I've got a form where i need to pull both the directory of a filename and the directory with the filename of an .inf file... I figured the easiest way to do this was to have an <input id=test...
3
by: Enyi | last post by:
Situation : Need to get a list of files in a directory, but I am currently getting the whole path of the file (Example: "C:\A Folder\Another Folder\file.txt"). What I want is just the filename and...
12
by: vj | last post by:
I am using Borland C++. I run a program which generates output data files, say 'Voltage.dat', 'Current.dat'. I have a variable in my code (say N), and for various values of N (for each value of...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.