473,503 Members | 3,171 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Article Preview with substring

5 New Member
Hello,

I'm developing a press release system, and on the homepage, they want a short preview of the article. I would consider using left(...) to take the first x characters, however there is HTML in the articles. If you take a substring, you could end up with unclosed html tags, or end up somewhere in the middle of a tag (<a href="http://ww) Does anyone know of any functions that will let you take the proper amount of text, and leave the html tags intact?
Jul 2 '08 #1
1 1755
DrBunchman
979 Recognized Expert Contributor
Hi Trmbne2000,

You could write a function to do this that would parse through the string removing the html tags and creating a new string for you. This example below should help you to build something to suit your needs.
Expand|Select|Wrap|Line Numbers
  1.  
  2. flgHTML = False
  3. For i = 0 to 50 
  4.   If Mid(sString, i, 1) = "<" Then
  5.      flgHTML = True
  6.      i=i+1
  7.   End If
  8.  
  9.   If Mid(sString, i, 2) = "/>" Then
  10.      flgHTML = False
  11.      i=i+2
  12.   End If
  13.   If flgHTML = False Then sNewString = sNewString + Mid(sString, i, 1)
  14. Next
  15.  
Let me know how you get on,

Dr B
Jul 3 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
32219
by: miarte | last post by:
I have a form to allow the user upload images. The user browse for an image in their computer and click open, th image to be upload is preview on the img tag. The script works fine with IE, but...
0
2012
by: ps | last post by:
I am using this article to get a list of files in a directory using ftp. If I run the code without some kind of delay, I only get about half the files. If I put a debug.write statement it returns...
7
14338
by: Pat | last post by:
I would like to send the Print Preview of a MS Access form to a Snapshot file. The form contains an OLE graph. BACKGROUND A snapshot of a report is possible. If I could I would use a report to...
1
2597
by: sea | last post by:
I have Access 2002 and I am writing this application with a custom menu bar that has a print preview button -- the start up options hide the design window. The problem is that when an open form is...
0
1755
by: Shawn Mehaffie | last post by:
I am creatign a screen saver and am having a problem with showing the screensaver form in the preview pane. The code works correctly in the the form does display within the preview window. I created...
2
14102
by: Dean Slindee | last post by:
Anybody written code in VB.NET to: 1) show a print preview window of reports already written and stored in an Access 2002 database; or 2) execute the print of a report stored in an Access 2002...
1
5682
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out...
1
2328
by: bonnie.tangyn | last post by:
Hello All In my ASP page, I use CDONT to send email to client. But, I need to allow user preview and edit the email content before sending it out. Any advices? I have two ASP pages -...
2
8303
by: deepakfordotnet | last post by:
Hi, First of all let me confess that I could not get the solution to the same problem from an earlier post Printing :by Mr.Richard MSL (dated September 24th 2006) working. (Replied by Mr.Walter...
0
7188
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7258
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7313
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6970
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7441
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4987
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3156
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1489
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.