Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 13th, 2003, 12:27 PM
Authorized User
 
Join Date: Oct 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to ittorget
Default Help with letters

I need to know how to do this.....
If i have a tabell in a database with a cell containing a name with 14 letter.

Example: kalle andersson

If i want this name to be shoen as this instead: kalle anders...

How is this posible with script.
I know i must count the letters in the questin but how ??

 
Old October 13th, 2003, 06:53 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 344
Thanks: 0
Thanked 1 Time in 1 Post
Default

You can use the LEFT and RIGHT commands at the ASP level to get this effect, also the SUBSTRING command in Javascript on the client side will do the same thing.
 
Old October 13th, 2003, 11:53 PM
Authorized User
 
Join Date: Sep 2003
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to balakumar1000
Default

You can use the select statement like this:

select case
    when len(firstname) > 5 then substring(firstname,1,3) + '...'
    else firstname
end
from table1

--substring(expr, starting, length)

Balakumar V.

 
Old October 14th, 2003, 01:11 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I once did something like this when I had to truncate breadcrumbs...
Code:
full = recTmp("thename")
name = Trim(Left(full, numberOfcharacters))
If Len(full) > numberOfcharacters Then 
   name = name & "..."
End If
Then you can use 'name' to display.

Hope it helps

Jacob.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Latin letters itHighway Classic ASP Professional 3 July 20th, 2006 12:14 AM
Remove letters from numbers Corey Access 7 December 18th, 2005 09:09 PM
"C++ lottery" with letters and words dovids C++ Programming 8 July 19th, 2005 03:11 AM
Capital Letters no Vowels. endamist BOOK: Beginning Java 2 1 August 12th, 2003 05:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.