HighDots Forums  

Counting variable characters

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Counting variable characters in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
sebsal
 
Posts: n/a

Default Counting variable characters - 11-16-2004 , 08:37 AM






I am tryind to display a certain amount of characters from a result and further
text depending on the amount of characters. So far I have <% dim tissue
tissue = Recordset2.Fields.Item('Issues').Value %> <%
response.write(Left(tissue,60)) &amp; '...' %> I only want to pull 60
characters back and this works with the above code. The problem is that I only
want to display the '...' if the result is over 60 characters. The above code
displays '...' every time. Thanks in advance Craig Graham


Reply With Quote
  #2  
Old   
Jon Spivey
 
Posts: n/a

Default Re: Counting variable characters - 11-16-2004 , 08:44 AM






Hi,
Check the length first
<%
s = Recordset2.Fields.Item('Issues').Value
if len(s) > 60 then s = left(s,60) & "...."
response.write s
%>

Jon

"sebsal" <webforumsuser (AT) macromedia (DOT) com> wrote

Quote:
I am tryind to display a certain amount of characters from a result and
further
text depending on the amount of characters. So far I have <% dim tissue
tissue = Recordset2.Fields.Item('Issues').Value %> <%
response.write(Left(tissue,60)) &amp; '...' %> I only want to pull 60
characters back and this works with the above code. The problem is that I
only
want to display the '...' if the result is over 60 characters. The above
code
displays '...' every time. Thanks in advance Craig Graham




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.