Print Page | Close Window

Read only first 64 letters

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=16743
Printed Date: 29 March 2026 at 1:57pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Read only first 64 letters
Posted By: zMaestro
Subject: Read only first 64 letters
Date Posted: 29 September 2005 at 10:28am

Hi,

I've a database field (memo) i want to read the first 256 letters of it and disregard all the other.
 
i.e. if the field content is:
Quote blah blahblah blahblah blahblah blah.....blah blahblah blahblah blahblah blah
i want to read only the first 64 letters of these blahs
 
thanks.



Replies:
Posted By: dfrancis
Date Posted: 29 September 2005 at 10:54am

FUNCTION ShortText(str)

 If Len(str) > 64 Then
  dot = "..." 
  ShortText = Left(str,61) & dot
 Else
  ShortText = str
 End IF

END FUNCTION

<%=ShortText("blah blahblah blahblah blahblah blah.....blah blahblah blahblah blahblah blah")%>
 
Result:
 
blah blahblah blahblah blahblah blah.....blah blahblah blahb...
 
Note: my function adds the three dots to indicate the string has been shortened.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net