Ask a Question related to Macromedia ColdFusion, Design and Development.
-
WestSide #1
How to strip of characters when long text is displayed?
Hi,
I was wondering if anyone had some function or has had to strip off characters
from a long string. We have a user inteface, and the text is long, like we
display 'descriptions' but I want to "SNIP" the text off a set point and then
have the trailing ...... at the end.
This seems like a common thing... any ideas.
-WestSide
WestSide Guest
-
strip span tag from text-only templates
Hi, I am building a control that renders as a table, and I created two templates for my users to "wrap" the table with whatever HTML tags they... -
Swedish characters not displayed in datagrid
I'm retrieving data from a Sybase database and loading it into a dataset and displaying it in a datagrid. The problem that I'm having is the swedish... -
how to read japanese characters (multilingual characters) from a text file and save them in Access database ???
HI All i m trying to read a text file, having some japanese characters and saved as UTF-8 encoding. I m using ASP,FSO ... my code is below,... -
String manipulation of a URL - strip preceding characters?
How would I strip out everything from before the last "/" in the following string generated from request.servervaraibles method: ... -
Strip Leading Characters ??
I'd like to strip various leading characters from a registration number. for example MA1234 = 1234 987651 = 987651 Q10001 = 10001 The code... -
CriticalIM #2
Re: How to strip of characters when long text isdisplayed?
<cfset LongDescription = 'This is a sample of more than 25 characters of text'>
<cfoutput> <cfif Len(LongDescription) GT 25> #Left(LongDescription, 25)#...
<cfelse> #LongDescription# </cfif> </cfoutput>
CriticalIM Guest
-
dempster #3
Re: How to strip of characters when long text isdisplayed?
Another approach, if you want it to look a little better, is to define the
maximum length you want and then find a breaking point (space, period, question
mark, etc.) to trim the string. In this example, I take the text of an
article,extract the first 75 characters, and reverse them. The I look for one
of these break points, copy the string (MID function) from that point on,
reverse it again, and add the trailing ... at the end. Works pretty well.
-Paul Paul Dempsey Dickinson College
<CFSCRIPT>
tempsyn = Reverse(Left(rsDate.article,75));
artsyn = Reverse(Mid(tempsyn,FindOneOf(". ?!",tempsyn),75)) & "...";
</CFSCRIPT>
dempster Guest
-
kyle969 #4
Re: How to strip of characters when long text isdisplayed?
Try this for some reusability...
<cfscript>
function snipString(argString, argLength){
var rtnString = left(argString,argLength);
if(Len(argString) gt argLength)
rtnString = rtnString & '...';
return rtnString;
}
</cfscript>
<cfset LongDescription = "This is a sample of more than 25 characters of
text">
<cfoutput>#snipString(LongDescription,25)#</cfoutput>
kyle969 Guest



Reply With Quote

