Adobe Community
All community
This category
This board
Knowledge base
Users
cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results forÂ
ShowÂ
 onlyÂ
|
Search instead forÂ
Did you mean:Â
Global community
Language:
Deutsch
English
Español
Français
Português
日本語コミュニティ
Dedicated community for Japanese speakers
í•œêµ ì»¤ë®¤ë‹ˆí‹°
Dedicated community for Korean speakers
Sign In
Exit
Home
ColdFusion
Discussions
Trimming more than one Words
Home
ColdFusion
Discussions
Trimming more than one Words
0
Upvote
Trimming more than one Words
henni2003
New Here
,
/t5/coldfusion-discussions/trimming-more-than-one-words/td-p/728031
Dec 20, 2006
Dec 20, 2006
Copy link to clipboard
Copied
I have a Name field in my DB which can have more than one name seperated by spaces. I want to trim this name-field to just one word while outputting.
Example:
"Michael Theodor John"
Is outputted as simply
"Michael"
I'm working with trimming and find but not quite getting it right. Anyone suggestions?
Thank you very much,
Henrik
TOPICS
Advanced techniques
Views
258
Translate
Translate
Report
Report
Follow
Report
More
Reply
Reply
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
azadisaryev
Engaged
,
Dec 20, 2006
Dec 20, 2006
azadisaryev
•
Engaged
,
Dec 20, 2006
Dec 20, 2006
you can treat the name as a space-delimited list and use the ListGetAt function to get the first element of the list:
<cfoutput>#listgetat([youqueryname].name, 1, " ")#</cfoutput>
Votes
0
Upvote
Translate
Translate
Jump to answer
3 Replies
3
Jump to latest reply
Correct answer by
azadisaryev
Engaged
,
/t5/coldfusion-discussions/trimming-more-than-one-words/m-p/728032#M67958
Dec 20, 2006
Dec 20, 2006
Copy link to clipboard
Copied
you can treat the name as a space-delimited list and use the ListGetAt function to get the first element of the list:
<cfoutput>#listgetat([youqueryname].name, 1, " ")#</cfoutput>
Votes
0
Upvote
Translate
Translate
Report
Report
Follow
Report
More
Reply
Reply
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
henni2003
AUTHOR
New Here
,
/t5/coldfusion-discussions/trimming-more-than-one-words/m-p/728033#M67959
Dec 20, 2006
Dec 20, 2006
Copy link to clipboard
Copied
Thanks, works like a charm!
Votes
0
Upvote
Translate
Translate
Report
Report
Follow
Report
More
Reply
Reply
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Newsgroup_User
LEGEND
,
/t5/coldfusion-discussions/trimming-more-than-one-words/m-p/728034#M67960
Dec 20, 2006
Dec 20, 2006
Copy link to clipboard
Copied
LATEST
Just to spread the knowledge of CF functions you could have also used
the listFirst function which returns the first element of a list.
<cfoutput>#listFirst([youqueryname].name," ")#</cfoutput>
Votes
0
Upvote
Translate
Translate
Report
Report
Follow
Report
More
Reply
Reply
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Post Reply
Preview
Exit Preview
never-displayed
You must be signed in to add attachments
never-displayed
Â
Resources
Documentation
ColdFusion User Guide