Thank you John.
>Hi Denis
>
>>>Product A 10$
>>>Product B 20$
>>>Product C
>>>Product D
>
>It should be possible to use Regex transformations to remove words containing $, e.g. using Craig Boyd's excellent Regex fll.
>
>But for a pure VFP solution: If you can be sure there's no spaces inside the price and no other content mixed into it, then something like this should get rid of it:
>
>
>lcstring="Product A $20 More content"
>
>local liAt,lcLeft
>lcString=chrtran(m.lcString,chr(9)," ")
>liAt=at("$",m.lcString)
>do while m.liat>0
> lcLeft=left(m.lcString,m.liat)
> lcLeft=left(m.lcLeft,rat(" ",m.lcleft))
> lcString=substr(m.lcString,m.liAt)
> lcString=substr(m.lcString,at(" ",m.lcString))
> lcString=alltrim(m.lcLeft)+" "+alltrim(m.lcString)
> liAt=at("$",m.lcString)
>ENDDO
>? lcstring
>
>This code handles multiple prices, $20 as well as 20$ and will preserve any content after the price, which does no harm if the price is always last but in any case is easily prevented by not bothering with the rest of the lcString once you grab the lcLeft.
*******************************************************
Save a tree, eat a beaver.
Denis Chassé