Hi, I wonder if someone can tell me if its possible to combine two functions. Both work fine as they are written here, but i need them to work together in the output. I imagine that one must write to combine sNewsTitle and sDescription = statement.
Thanks for any pointers of theory
Richard function 1 (shorten text) - Function Shorten(sString, sLength)
-
If Len (sString) > sLength Then
-
Shorten = Left(sString,sLength) & "...."
-
Else
-
Shorten = sString
-
End If
-
End Function
-
- Dim sNewsTitle
-
sNewsTitle= rs("statement")
-
-
-
-
-
<%
-
sNewsTitle=Shorten(sNewsTitle,190)
-
Response.Write sNewsTitle
-
%>
function 2 ( to strip html from string) - Function RemoveHTML( strText )
-
Dim TAGLIST
-
TAGLIST = ";!--;!DOCTYPE;A;ACRONYM;ADDRESS;APPLET;AREA;B;BASE;BASEFONT;" &_
-
"BGSOUND;BIG;BLOCKQUOTE;BODY;BR;BUTTON;CAPTION;CENTER;CITE;CODE;" &_
-
"COL;COLGROUP;COMMENT;DD;DEL;DFN;DIR;DIV;DL;DT;EM;EMBED;FIELDSET;" &_
-
"FONT;FORM;FRAME;FRAMESET;HEAD;H1;H2;H3;H4;H5;H6;HR;HTML;I;IFRAME;IMG;" &_
-
"INPUT;INS;ISINDEX;KBD;LABEL;LAYER;LAGEND;LI;LINK;LISTING;MAP;MARQUEE;" &_
-
"MENU;META;NOBR;NOFRAMES;NOSCRIPT;OBJECT;OL;OPTION;P;PARAM;PLAINTEXT;" &_
-
"PRE;Q;S;SAMP;SCRIPT;SELECT;SMALL;SPAN;STRIKE;STRONG;STYLE;SUB;SUP;" &_
-
"TABLE;TBODY;TD;TEXTAREA;TFOOT;TH;THEAD;TITLE;TR;TT;U;UL;VAR;WBR;XMP;"
-
-
Const BLOCKTAGLIST = ";APPLET;EMBED;FRAMESET;HEAD;NOFRAMES;NOSCRIPT;OBJECT;SCRIPT;STYLE;"
-
-
Dim nPos1
-
Dim nPos2
-
Dim nPos3
-
Dim strResult
-
Dim strTagName
-
Dim bRemove
-
Dim bSearchForBlock
-
-
nPos1 = InStr(strText, "<")
-
Do While nPos1 > 0
-
nPos2 = InStr(nPos1 + 1, strText, ">")
-
If nPos2 > 0 Then
-
strTagName = Mid(strText, nPos1 + 1, nPos2 - nPos1 - 1)
-
strTagName = Replace(Replace(strTagName, vbCr, " "), vbLf, " ")
-
-
nPos3 = InStr(strTagName, " ")
-
If nPos3 > 0 Then
-
strTagName = Left(strTagName, nPos3 - 1)
-
End If
-
-
If Left(strTagName, 1) = "/" Then
-
strTagName = Mid(strTagName, 2)
-
bSearchForBlock = False
-
Else
-
bSearchForBlock = True
-
End If
-
-
If InStr(1, TAGLIST, ";" & strTagName & ";", vbTextCompare) > 0 Then
-
bRemove = True
-
If bSearchForBlock Then
-
If InStr(1, BLOCKTAGLIST, ";" & strTagName & ";", vbTextCompare) > 0 Then
-
nPos2 = Len(strText)
-
nPos3 = InStr(nPos1 + 1, strText, "</" & strTagName, vbTextCompare)
-
If nPos3 > 0 Then
-
nPos3 = InStr(nPos3 + 1, strText, ">")
-
End If
-
-
If nPos3 > 0 Then
-
nPos2 = nPos3
-
End If
-
End If
-
End If
-
Else
-
bRemove = False
-
End If
-
-
If bRemove Then
-
strResult = strResult & Left(strText, nPos1 - 1)
-
strText = Mid(strText, nPos2 + 1)
-
Else
-
strResult = strResult & Left(strText, nPos1)
-
strText = Mid(strText, nPos1 + 1)
-
End If
-
Else
-
strResult = strResult & strText
-
strText = ""
-
End If
-
-
nPos1 = InStr(strText, "<")
-
Loop
-
strResult = strResult & strText
-
-
RemoveHTML = strResult
-
End Function
-
-
- <%
-
-
Dim sDescription
-
sDescription = rs("statement")
-
-
If IsBlank(rs("statement")) Then
-
%>
-
<p>This member has not yet written a statement</p>
-
<%
-
Else
-
%>
-
-
<p>
-
-
<%=RemoveHTML(sDescription)%>
-
</p>
-
<%
-
End If
-
%>
Shorten(RemoveHTML(statement), 190) 3 1225
You haven't explained how you want to combine them.
Hi, Oh sorry. I want the results from the field "statement" to be shortened and also stripped of html.
Thanks for any pointers
Richard
Shorten(RemoveHTML(statement), 190) Sign in to post your reply or Sign up for a free account.
Similar topics
by: Sergey |
last post by:
Is it possible to realize such an algorithm (this one is not working):
class a1 {
public:
void af () { bf(); }
virtual void bf () = 0;
};
|
by: Gibby Koldenhof |
last post by:
Hiya,
Terrible subject but I haven't got a better term at the moment.
I've been building up my own library of functionality (all nice conforming
ISO C) for over 6 years and decided to adopt a...
|
by: Telmo Costa |
last post by:
What should i call the functions named Factorial_ in this sample code:
class SomeClass {
...
public int Factorial(int f) {
if (f<0) throw SomeException("Some message.");
if (f==0 || f==1)...
|
by: steve_h |
last post by:
I think the subject says it all, but just in case:
I know that I can call my own methods during an XSL transformation
using
<xsl:value-of select="myObject.someMethod(arg1)" />
having done...
|
by: T Perkins |
last post by:
is there a way to have intellesence give a list of options for each
parameter of a newly create functions. an example would be, using
messagebox.show. after you put in the message and label, you...
|
by: Eric Fortier |
last post by:
Hi all,
Last year I posted a message regarding templates use in blitter functions, but
the single answer I got didn't help.
My problem is that I was writing blitter functions which takes a...
|
by: tshad |
last post by:
I have about 10 functions that are identical except for one variable name
that I am using in my "for" loop:
for (ktr1=1;ktr1<=nhDataBean.projectCodeList.GetUpperBound(0);ktr1++)
for...
|
by: Luvin lunch |
last post by:
Hi,
I'm new to access and am very wary of dates as I have limited
experience in their manipulation and I know if they're not done
properly things can turn ugly quickly.
I would like to use a...
|
by: Amit Dedhia |
last post by:
Hi All
I have a VC++ 2005 MFC application with all classes defined as
unmanaged classes. I want to write my application data in xml format.
Since ADO.NET has buit in functions available for...
|
by: fjm |
last post by:
I have one jquery function that submits data via a datastring to my server. This works great. On success, I currently have a little alert box that lets the user know that the data was stored.
I...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
| |