hey all, i've asked this on a number of VFP sites and gotten many different answers- can anyone tell me how to include programming in VFP7 to strip Windows line breaks-
hex:
0D 0A
which is Chr(13) and Char(10) which is a line break for Windows

any help is greatly appreciated

hey all, i've asked this on a number of VFP sites and gotten many different answers- can anyone tell me how to include programming in VFP7 to strip Windows line breaks-
hex:
0D 0A
which is Chr(13) and Char(10) which is a line break for Windows

any help is greatly appreciated

Okay, let me try a dab at this one!

Let's imagine you have a huge string called "HugeContent" with content which has lots of CR+LF or 0D 0A as you put it. If you want to strip them all in one shot, here is the super complex code for that..

[ HugeContent = strtr(HugeContent,chr(13)+chr(10),"") ]

The "" is the content which will replace the CR LF and it turns out to be an empty string. It will replace every instance, unless you limit it. But if you just want to do the first 10, then you write this...

[ HugeContent = strtr(HugeContent,chr(13)+chr(10),"",1,10) ]

Ha ha ah, ... you thought it was going to be complicated! No need for iteration or any silly things. This is VFP...

Dennis

Note...
VFP is the superlative language, which once it is gone it will be a tragedy.

Okay, let me try a dab at this one!

Let's imagine you have a huge string called "HugeContent" with content which has lots of CR+LF or 0D 0A as you put it. If you want to strip them all in one shot, here is the super complex code for that..

[ HugeContent = strtr(HugeContent,chr(13)+chr(10),"") ]

The "" is the content which will replace the CR LF and it turns out to be an empty string. It will replace every instance, unless you limit it. But if you just want to do the first 10, then you write this...

[ HugeContent = strtr(HugeContent,chr(13)+chr(10),"",1,10) ]

Ha ha ah, ... you thought it was going to be complicated! No need for iteration or any silly things. This is VFP...

Dennis

Note...
VFP is the superlative language, which once it is gone it will be a tragedy.

thank you, Dennis- his was the best answer that i have gotten so far

thank you, Dennis- his was the best answer that i have gotten so far

Glad I could help. Are you doing a migration from VFP to C# or something like that?


Dennis

This article has been dead for over six months. Start a new discussion instead.