Welcome to Dream.In.Code
Getting Help is Easy!

Join 131,718 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,346 people online right now. Registration is fast and FREE... Join Now!




Name field but want to trim last name off..

 
Reply to this topicStart new topic

Name field but want to trim last name off..

jeffmc21
post 6 Oct, 2008 - 01:36 PM
Post #1


New D.I.C Head

*
Joined: 27 Nov, 2007
Posts: 46


My Contributions


I have a form that submits a name field. I would like to take the submitted name and trim off the space and last name, so that in the response message, I can thank them for their submission but only use the first name (i.e., Thanks John instead of Thanks John Doe).

Can this be done? I'm relatively new to CF but enjoying learning.
User is offlineProfile CardPM

Go to the top of the page

CR250
post 6 Oct, 2008 - 02:37 PM
Post #2


New D.I.C Head

*
Joined: 14 Jun, 2008
Posts: 16



Thanked 1 times
My Contributions


QUOTE(jeffmc21 @ 6 Oct, 2008 - 02:36 PM) *

Can this be done? I'm relatively new to CF but enjoying learning.


Yes its easy:

<cfset name = "John Doe" />
<cfset firstName = listGetAt(name, 1, " ") />
<cfoutput>#firstName#</cfoutput>

ListGetAt( "the string", position you want to get, " delimiter " )
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/20/08 09:58AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month