Skip to main content
Known Participant
May 6, 2008
Question

trim

  • May 6, 2008
  • 4 replies
  • 475 views
Hi.I have a table with a field wich has these values:
Top Low-Carb Products
Top Fat-Burners
Top Fat-Burners
...

how can I get rid of "Top" at the beging of each row?
thanks
This topic has been closed for replies.

4 replies

Known Participant
May 7, 2008
thanks
tclaremont
Inspiring
May 7, 2008
<CFIF #Left(StringName,4)# = 'Top '>
<CFSET NewString = #Replace(StringName, "Top ", "")#>
<CFELSE>
<CFSET NewString = #StringName#>
</CFIF>

#NewString#
Inspiring
May 7, 2008
The query in your sql is part of your code. But, the more I think about it, you probably want this logic

if the 1st four characters are "Top "
do something to get rid of it. RemoveChars might work.
Inspiring
May 7, 2008
If your db has string functions, use one in your select clause.
Known Participant
May 7, 2008
but I need to do it in the code.