Adjusting String length
I have a DIV with fixed height and the text what i can echo here is of max 100 Characters. But what I get is Dynamic text. This开发者_高级运维 can also cantain 500 Characters.
And this text may also contain html tags.
Now I can simply take the first 100 Characters, as it can cut the tag. Like
<string> Sample Text Here</st ...
And this will make the contents of the complete website BOLD.
Which will a better way to do this?
It sounds like you want to strip the HTML tags and then trim to the first 100 characters:
#left(reReplace(variables.inputString,'<[^>]+>','','ALL'), 100)#
May be like this.
<cfset strWithoutTag = rereplace(strWithTag,"<[\/]*\w+[^>]*>","","all")>
<cfdump var="#strWithoutTag#">
<cfset truncStr = left(strWithoutTag,100)>
<cfdump var="#truncStr#">
精彩评论