Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Delete a field

Can someone please let me know how I would delete the first and last character
on a mem variable.
Thanks
Paul
[131 byte] By [Paul Summerfield] at [2007-11-10 12:50:58]
# 1 Re: Delete a field
>Can someone please let me know how I would delete the first and last character
>on a mem variable.

get the length of the variable. If ten:
memvar= substr(memvar,2,9)
or
Replace field with substr(memvar,2,9)
There is other ways to do this.
Jarrett at 2007-11-11 23:50:28 >
# 2 Re: Delete a field
If you need to delete the first and last characters, your length would need
to be 8, not 9.

Fred
Micorosoft Visual FoxPro MVP

"Jarrett" <Jcrudisill@yahoo.com> wrote in message
news:3f6872be$1@tnews.web.dev-archive.com...
>
>
> >Can someone please let me know how I would delete the first and last
character
> >on a mem variable.
>
>
> get the length of the variable. If ten:
> memvar= substr(memvar,2,9)
> or
> Replace field with substr(memvar,2,9)
> There is other ways to do this.
Fred Taylor at 2007-11-11 23:51:33 >
# 3 Re: Delete a field
"Fred Taylor" <ftaylor@mvps.org> wrote:
>If you need to delete the first and last characters, your length would need
>to be 8, not 9.

Thanks Fred. Didn't test my code before I put it out there. I should know
not to do that by know.
Jarrett at 2007-11-11 23:52:29 >
# 4 Re: Delete a field
cString = "abcdefg"
? SUBSTR(cString, 2, LEN(cString) - 2)

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
cindy.winegarden@mvps.org, www.cindywinegarden.com

"Paul Summerfield" <fox@quantumistic.co.uk> wrote in message
news:3f686518$1@tnews.web.dev-archive.com...
>
> Can someone please let me know how I would delete the first and last
character
> on a mem variable.
Cindy Winegarden at 2007-11-11 23:53:34 >