Remove LineBreak

pdabasic

Active Member
Licensed User
Hello!

I have a variable:
param=
<table class="productparameter" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr><th colspan="2"><strong>Termékparaméterek: </strong></th></tr>
<tr class="row1" height="18">
<td width="30%" class="pname">Max.Teljesítmény</td>
<td>1x40 W</td></tr>
<tr class="row0" height="18">
<td width="30%" class="pname">Magasság</td>
<td>23 cm</td></tr>
<tr class="row1" height="18">
<td width="30%" class="pname">Szélesség</td>
<td>17 cm</td></tr>
<tr class="row0" height="18">
<td width="30%" class="pname">Izzótípus</td>
<td>G9 </td></tr>
</table>

I need to replace the line breaks. I tried to this but doesn't work:

param=StrReplace(param,CRLF _
,"")

Plese help me
 

pdabasic

Active Member
Licensed User
It works like this:

param:StrReplace(Chr(13),"")
param:StrReplace(Chr(10),"")

What is Chr(10) and Chr(13)?
 

pdabasic

Active Member
Licensed User
It works like this (sorry):

param=StrReplace(param,Chr(13),"")
param=StrReplace(param,Chr(13),"")

What is Chr(10) and Chr(13)?
 

klaus

Expert
Licensed User
Longtime User
Sorry, I didn't notice that you asked in the B4PPC forum.
Chr(10) = LF LineFeed
Chr(13) = CR CarriageReturn
In Windows and in B4PPC a 'next line' is defined by CRLF which meens the two characters Chr(13) & Chr(10).

It would work with
param=StrReplace(param,Chr(13),"")
param=StrReplace(param,Chr(10),"")
or try to use
param=StrReplace(param,CRLF,"")
CRLF = Chr(13) & Chr(10) in B4PPC

EDIT changed the second Chr(13) with Chr(10)
Best regards.
 
Last edited:

mjcoon

Well-Known Member
Licensed User
It would work with
param=StrReplace(param,Chr(13),"")
param=StrReplace(param,Chr(13),"")
or try to use
param=StrReplace(param,CRLF,"")
CRLF = Chr(13) & Chr(10) in B4PPC

Best regards.

I expect Klaus meant

B4X:
param=StrReplace(param,Chr(10),"")
param=StrReplace(param,Chr(13),"")

There is an ambiguity that sometimes the LF is taken to mean newline without including the carriage return (which is of course a hang-over from teletypes which needed a delay for the carriage movement to complete). So searching for the combination may fail whereas a separate search may work. Examine your file with a hex viewer to see the actual encoding.

BTW I find that sometimes a downloaded text file displays in Notepad with lines run together whereas with Wordpad the new-line characters are effective.

Mike.
 
Top