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 March 17th, 2006, 01:12 PM
Friend of Wrox
 
Join Date: May 2005
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default email

I loop through a database email field to display the emails
but I want to show whatever comes after @ to be demo.com
like this
john@yahoo.com>>john@demo.com
how should I write the code?

 
Old March 17th, 2006, 07:13 PM
Wrox Technical Editor
 
Join Date: Dec 2005
Posts: 271
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You could use the InStr function to find the '@' sign,
subtract the location of the '@' from the string Length,
then use the Right function to get the domain name.

There are many ways this can be done.

VBScript Functions: http://www.w3schools.com/vbscript/vb..._functions.asp

- A.Kahtava
 
Old March 20th, 2006, 12:05 AM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

As Adam said there are many ways to skin a cat, how would I do it:

dim address,result
address = "some.guy@someaddress.com.au"
result = left(address,(InStr(address, "@")-1))
response.write result

I have made the assumption you know how the place this code in a loop.

Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
C# and Email iceman90289 C# 2005 8 June 25th, 2008 11:44 AM
Email through Gmail in C# tobriain C# 5 April 5th, 2007 07:57 AM
Email reports william.murray Access 3 May 11th, 2006 02:34 AM
Email Component vikasp2p General .NET 1 September 22nd, 2004 09:19 AM





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