473,396 Members | 2,070 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Character Trim

I'm pulling customer testimonials from an SQL database onto the
homepage of a site. I want to set a trim that will not allow more than
250 characters of the testimonial to show. Anything over 250 would be
cut of and replaced with "..." I already have a link below that will
take them to a page that displays all testimonials. Current code (a
little messy):

<td width="220" height="97" valign="top">
<span
class="style4">&quot;<%=(Testimonials.Fields.Item( "test_desc").Value)%>...&quot;<br
/>
-
<%=(Testimonials.Fields.Item("test_name").Value)%> </span></td>

I want to trim the "test_desc." Any Ideas?

Jun 29 '06 #1
2 2261
Daniel

The simplest method would be in your SQL string.

Use

Select SubString(test_desc,0,250) + '...' as test_desc_trimmed,
test_name from tblMyTable

Then change your html to point to the renamed field.

Jared
da************@gmail.com wrote:
I'm pulling customer testimonials from an SQL database onto the
homepage of a site. I want to set a trim that will not allow more than
250 characters of the testimonial to show. Anything over 250 would be
cut of and replaced with "..." I already have a link below that will
take them to a page that displays all testimonials. Current code (a
little messy):

<td width="220" height="97" valign="top">
<span
class="style4">&quot;<%=(Testimonials.Fields.Item( "test_desc").Value)%>...&quot;<br
/>
-
<%=(Testimonials.Fields.Item("test_name").Value)%> </span></td>

I want to trim the "test_desc." Any Ideas?


Jun 29 '06 #2
I assume that you would want to cut the text between two words. Here is
a method that does it's best to do that:

http://www.guffa.com/Programming_archive.asp?id=42
da************@gmail.com wrote:
I'm pulling customer testimonials from an SQL database onto the
homepage of a site. I want to set a trim that will not allow more than
250 characters of the testimonial to show. Anything over 250 would be
cut of and replaced with "..." I already have a link below that will
take them to a page that displays all testimonials. Current code (a
little messy):

<td width="220" height="97" valign="top">
<span
class="style4">&quot;<%=(Testimonials.Fields.Item( "test_desc").Value)%>...&quot;<br
/>
-
<%=(Testimonials.Fields.Item("test_name").Value)%> </span></td>

I want to trim the "test_desc." Any Ideas?

Jun 29 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: knocker | last post by:
Hi I have a problem with JSP on websphere 5. When I try save information with swedish or danish ÅÄÖ characters, the string is cut where the first of these characters occurs. The JDK used is...
5
by: Wai Yip Tung | last post by:
When I do for line in fp: the line string usually has a '\n' at the end. In many cases I don't want the line break character. I can trim it using if line.endswith('\n'): line = line ...
22
by: Simon | last post by:
Hi, I have written a function to trim char *, but I have been told that my way could be dangerous and that I should use memmove(...) instead. but I am not sure why my code could be 'dangerous'...
7
by: teachtiro | last post by:
Hi, 'C' says \ is the escape character to be used when characters are to be interpreted in an uncommon sense, e.g. \t usage in printf(), but for printing % through printf(), i have read that %%...
4
by: Eps | last post by:
My program has an ini file which i read in the settings for the program. The main setting is the path where files are to be saved. At the moment it doesn't work, but if I hardcode the path it does...
2
by: ad | last post by:
I have a string variable lik: sList="1.Tiger, 2.Wolf, 3.Rabbit," I want to trim off the last character "," Have there pre-define function to do that?
3
by: Raed Sawalha | last post by:
I have the following letters; string letters = "a;b;c....to z"; the I need to replace the incoming string which containing letters above with integer 1 i did following for(int...
3
by: kababoom | last post by:
Hi i'm using Oracle 9i has any one encountered this strange problem whereby rtrim cannot trim certain character; for my case i notice it does not trim characters ending wif J or Q while the rest of...
3
kcdoell
by: kcdoell | last post by:
Hello: I have a Insert Into command that currently works: DoCmd.RunSQL "INSERT INTO TypeEorD ( EorDName, EorD ) SELECT Trim( & '_' & Trim(Category)), Trim(CatType);" "Category" is a manual...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.