Does anyone know how to programatically remove blank lines from the end of a
memo field? Sometimes my users will hit return in a memo field after the end
of the data and this causes blank lines on reports.

I have tried several suggestions found on Google groups archive but no
success. Tried all the trim(s) and no luck

Thanks in advance.
Brian Hiatt
Collectorpro Software Group, Inc.
www.collectorpro.com

Re: How to remove trailing blank lines (CR/LF) from memo field by Eric

Eric
Wed Dec 01 09:33:32 CST 2004

Hello, Brian!
You wrote on Wed, 1 Dec 2004 07:19:01 -0800:

BH> I have tried several suggestions found on Google groups archive but no
BH> success. Tried all the trim(s) and no luck

Try CHRTRAN() and or STRTRAN().
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8



Re: How to remove trailing blank lines (CR/LF) from memo field by Sietse

Sietse
Wed Dec 01 09:31:45 CST 2004

You can analyse the memo field using the ALINES() function, and return the
data without trailing CRLF:

*- Following code is completely untested, and may contain errors, but I
assume it'll give you a hint on what I mean
FUNCTION RemoveEndingCRLF(tcMemo)
LOCAL lcReturn
lcReturn = ""
lnLines = ALINES(laLines, tcMemo, .T.)
FOR lnCount = lnLines TO 1 STEP -1
IF NOT EMPTY(laLines[lnCount]) OR NOT EMPTY(lcReturn)
lcReturn = laLines[lnCount] + lcReturn
ENDIF
NEXT
RETURN lcReturn
ENDFUNC

HTH,
Sietse Wijnker


"Brian Hiatt" <BrianHiatt@discussions.microsoft.com> wrote in message
news:0F959F94-35DA-423E-8DE3-48CA3D0C9DE3@microsoft.com...
> Does anyone know how to programatically remove blank lines from the end of
> a
> memo field? Sometimes my users will hit return in a memo field after the
> end
> of the data and this causes blank lines on reports.
>
> I have tried several suggestions found on Google groups archive but no
> success. Tried all the trim(s) and no luck
>
> Thanks in advance.
> Brian Hiatt
> Collectorpro Software Group, Inc.
> www.collectorpro.com



Re: How to remove trailing blank lines (CR/LF) from memo field by Stefan

Stefan
Wed Dec 01 09:34:03 CST 2004


CR/LF is Chr(13)+Chr(10), so you can do something like

&& #define CRLF Chr(13)+Chr(10)
Do While Right( x, 4 ) == Replicate( CRLF, 2 )
x = Left( x, Len(x)-2 ) && etc


hth
-Stefan

"Brian Hiatt" <BrianHiatt@discussions.microsoft.com> schrieb im Newsbeitrag
news:0F959F94-35DA-423E-8DE3-48CA3D0C9DE3@microsoft.com...
> Does anyone know how to programatically remove blank lines from the end of a
> memo field? Sometimes my users will hit return in a memo field after the end
> of the data and this causes blank lines on reports.
>
> I have tried several suggestions found on Google groups archive but no
> success. Tried all the trim(s) and no luck
>
> Thanks in advance.
> Brian Hiatt
> Collectorpro Software Group, Inc.
> www.collectorpro.com


Re: How to remove trailing blank lines (CR/LF) from memo field by George

George
Wed Dec 01 15:44:23 CST 2004

in VFP9:

Rtrim(yourMemo,Chr(13)+Chr(10))

;-)

Brian Hiatt wrote:
> Does anyone know how to programatically remove blank lines from the end of a
> memo field? Sometimes my users will hit return in a memo field after the end
> of the data and this causes blank lines on reports.
>
> I have tried several suggestions found on Google groups archive but no
> success. Tried all the trim(s) and no luck
>
> Thanks in advance.
> Brian Hiatt
> Collectorpro Software Group, Inc.
> www.collectorpro.com

Re: How to remove trailing blank lines (CR/LF) from memo field by David

David
Wed Dec 01 22:10:42 CST 2004

Brian,

One more alternative (that's better than all the others (except for what
George showed is coming in VFP9) *g*)

lnLen = len( TheMemo )
do while ( substr( TheMemo, lnLen, 1 ) $ " " + chr(13) + chr(10) ) and (
lnLen > 0 )
lnLen = lnLen = 1
enddo

TheMemo = left( TheMemo, lnLen )

it'll remove trailing spaces, and CR or LF regardless of the possible orders
they can occur in.

--
df - Microsoft MVP FoxPro http://www.geocities.com/df_foxpro


"Brian Hiatt" <BrianHiatt@discussions.microsoft.com> wrote in message
news:0F959F94-35DA-423E-8DE3-48CA3D0C9DE3@microsoft.com...
> Does anyone know how to programatically remove blank lines from the end of
> a
> memo field? Sometimes my users will hit return in a memo field after the
> end
> of the data and this causes blank lines on reports.
>
> I have tried several suggestions found on Google groups archive but no
> success. Tried all the trim(s) and no luck



Re: How to remove trailing blank lines (CR/LF) from memo field by BrianHiatt

BrianHiatt
Fri Dec 03 10:29:07 CST 2004

David,
Thanks so much. Works great with a minor tweak. Replaced the = with a - on
the lnLength line and stored the value of the field to a variable and then
replace(d) the field with the memo. Could not get TheMemo to = to work.

Brian

"David Frankenbach" wrote:

> Brian,
>
> One more alternative (that's better than all the others (except for what
> George showed is coming in VFP9) *g*)
>
> lnLen = len( TheMemo )
> do while ( substr( TheMemo, lnLen, 1 ) $ " " + chr(13) + chr(10) ) and (
> lnLen > 0 )
> lnLen = lnLen = 1
> enddo
>
> TheMemo = left( TheMemo, lnLen )
>
> it'll remove trailing spaces, and CR or LF regardless of the possible orders
> they can occur in.
>
> --
> df - Microsoft MVP FoxPro http://www.geocities.com/df_foxpro
>
>
> "Brian Hiatt" <BrianHiatt@discussions.microsoft.com> wrote in message
> news:0F959F94-35DA-423E-8DE3-48CA3D0C9DE3@microsoft.com...
> > Does anyone know how to programatically remove blank lines from the end of
> > a
> > memo field? Sometimes my users will hit return in a memo field after the
> > end
> > of the data and this causes blank lines on reports.
> >
> > I have tried several suggestions found on Google groups archive but no
> > success. Tried all the trim(s) and no luck
>
>
>

Re: How to remove trailing blank lines (CR/LF) from memo field by David

David
Fri Dec 03 19:08:46 CST 2004

Brian,

Sorry for the typo on the =. Yes, you'd need to use REPLACE if you want to
alter the actual memo content.

--
df - Microsoft MVP FoxPro http://www.geocities.com/df_foxpro

"Brian Hiatt" <BrianHiatt@discussions.microsoft.com> wrote in message
news:0845C2BD-5DDD-4588-9DB5-2AACBD700EC6@microsoft.com...
> David,
> Thanks so much. Works great with a minor tweak. Replaced the = with a -
> on
> the lnLength line and stored the value of the field to a variable and then
> replace(d) the field with the memo. Could not get TheMemo to = to work.