Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trim s from right of a plural keyword

Status
Not open for further replies.

gtbikerider

Technical User
May 22, 2001
81
0
0
GB
I have a way for people to search for database records. I want to find plurals and singular so I want to strip the 's' off their keyword. So far I have

<!--- trim off the s if its plural --->
<cfif #right(Attributes.Keywords,1)# IS "s">
cfset the Attributes.Keywords to be trimmed 1 char from the right
</cfif>

Whats the bit in the middle to reset the keywords without the s on the end? Or please advise if there's a better way.

--
John

--
John
 
Try:
Code:
<cfset Attributes.Keywords=Mid(Attributes.Keywords,1,Max((Len(Attributes.Keywords)-1),1))>

I put the max in there to ensure Attributes.Keywords returns at least one character.

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 
Did ths work for you John?

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 
That worked perfectly Lyndon - Thank you.

--
John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top