> > I use this code to extract a potion of a word when a space is encountered:
> >
> >
> > BrandPartName=""
> > for i = 1 to len(alltrim(c_InvList.partName))
> > if substr(c_InvList.partName,i,1) = spac(1)
> > store substr(c_InvList.partName,1,i-1) to BrandPartName
> > exit
> > endi
> > endfor
> > if empty(Alltrim(BrandPartName))
> > Store Alltrim(c_InvList.partName) To BrandPartName
> > endi
> > *wait wind 'BrandPartName :'+brandpartname
> >
> >
> >
> >
> > Is there a much simpler way - maybe the use of a VFP function - to do this?
> >
> > TIA
> >
> > Patrick
>
> Your code as an one-liner:
>
>
> BrandPartName = TRIM(EVL(STREXTRACT(ALLTRIM(c_InvList.partName),""," "),ALLTRIM(c_InvList.partName)))
>
>
> [edit]
>
> and a shorter version:
>
>
> BrandPartName = TRIM(STREXTRACT(LTRIM(c_InvList.partName) + " ",""," "))
>
>
> [/edit]
Hi Antonio,
Thanks very much. You code worked well for me. Just what I wanted.
Regards,
Patrick