Ask a Question related to Dreamweaver AppDev, Design and Development.
-
ceaseanddesist #1
strip out html
is there a function in asp to strip out html characters ?
adam
ceaseanddesist Guest
-
strip html tags from textarea content
Hi, I'm really new to flex developing, I'm writing a page that have to retrieve some content from an xml file and display it in some form... -
How to strip HTML markup from string?
Hello, I want to transform text with HTML markup to plain text. Is there some simple way how to do it? I can surely write my own function,... -
Strip Numbers
Hey could someone help me out here.... I need to strip numbers from a passed variable ex. 3899007 all the numbers will have 990 (so that is... -
Strip html tags
Thanks Kindler, I'm sure it will, but I get a strange error when trying :( I'll figure something out. Cheers, Rob http://robgt.com/... -
Control Strip Gone?????
In article <2dd16f1c.0307031813.5a61dc27@posting.google.com>, Michael Graham <mgrahm@trib.com> wrote: Sometimes software will shut it off... -
Brandon Taylor #2
Re: strip out html
I wrote this function to shorten a paragraph of text which contained HTML
and then show an ellipsis at the end of the string if it was over a certain
number of characters. It accepts 3 parameters, the string, the minimum
length in chraracters to shorten to and the maximum number of characters to
display. It will strip out all of the HTML tags in a string. You can modify
this function to not include the portion which shortens the string, and
still strip out all of the HTML.
Function ShortenHTML(inputString, minLength, maxLength)
If inputString <> "" Then
Dim theString, a, b, i, outputLimit, PunctuationString
theString = Trim(inputString)
Do
a = InStr(a + 1, theString, "<")
If a > 0 Then
b = InStr(a, theString, ">")
If b > 0 Then
theString = Trim(Left(theString, a - 1)) & " " & Trim(Mid(theString, b +
1))
Else exitLoop = True
End If
a = 0
Else exitLoop = True
End If
Loop Until exitLoop = True
PunctuationString = ".!?:;,"
outputLimit = maxLength
For i = 1 To Len(PunctuationString)
a = InStr(minLength, theString, Mid(PunctuationString, i, 1) & " ")
If a > 0 And a < outputLimit Then outputLimit = a
Next
outputString = Left(theString, outputLimit)
If Len(RTrim(theString)) > Len(RTrim(outputString)) Then outputString =
RTrim(outputString) & "..."
ShortenHTML = outputString
End If
End Function
Hope that gets you started,
bT
"ceaseanddesist" <poorleno@ukip.com> wrote in message
news:d6va7i$l9c$1@forums.macromedia.com...> is there a function in asp to strip out html characters ?
>
> adam
>
Brandon Taylor Guest
-
darrel #3
Re: strip out html
> I wrote this function to shorten a paragraph of text which contained HTML
certain> and then show an ellipsis at the end of the string if it was over aHere's a similiar one that I wrote using Regex. It also checks to make sure> number of characters.
that I don't break a word in the middle (only trims at the spaces).
function getCaption(ByVal YourItem as String) as String
' use a regex to strip out HTML tags (you may not need
' this if you're not storing HTML in the db field
dim r as New Regex("\<[^\>]+\>")
dim caption as String = r.replace(YourItem, "") 'this replaces all tags
with nothing (ie, strips them out)
dim trimmedCaption as String
dim strSpace as String = " "
dim location as integer
' this get's the location of the last character before the first space
after x number of characters (in this case, 40)
location = (Instr(40,caption,strSpace) - 1)
' trim the caption and add the elipses
trimmedCaption = (left(caption, location)) & "..."
return trimmedCaption
end function
darrel Guest



Reply With Quote

