Re-2: Removing CRLF from text

runrev at animabit.de runrev at animabit.de
Thu Aug 7 07:52:07 EDT 2008


crlf and cr are not the same!

from the docu:
Use the CRLF constant as an easier-to-read substitute for numToChar(13) & numToChar(10).
cr is  numToChar(13) only.
Runrev engages in text fields for optimization according to the used OS => you do in most cases not see the differences when using text fields. When using variables and binfiles the difference of crlf and cr can be important. In runrev you often have relicts of LineFeed LF (10) when using ftp from a win pc to a unix os. In this cases you have to replace crlf with cr (=remove numToCHar(10).
Regards, Franz



Original Message        processed by David InfoCenter 
Subject: Re: Removing CRLF from text (07-Aug-2008 13:30)
From:    Randy Hengst <iowahengst at mac.com>
To:      boehmisch at animabit.de


Hi Mark,

I played with your question by pasting your text example into a field, demo, and by grabbing a text file using the URL pattern you shared.

I thought that CR and LF are basically the same thing. So, when I used:
replace "+"&CR with "" in field "demo"

it seemed to work. I used RevStudio 2.9 on MacOSX4.11.

take care,
randy
-------------------

On Aug 6, 2008, at 7:17 PM, mfstuart wrote:


Hi,

RunRev: 2.90
OS: WinXP

I have a situation where a software application's ini file has the plus (+)
char and CRLF at the end of a line, when the line passes 80 characters. The
balance of the ini entry is placed on the next line. Each ini entry could be
very long and possibly go to 3 lines.
Why they did this I don't know, really.

But what I need to do is remove the + and CRLF so that each ini entry is
complete in itself, on one line.

ini file currently contains:
dfgsdfg sdfgsd fgsdfgsdf gsdfg +
sdfgadfs dgdghs dfdfgg fghf+
dfgh dfgh

Result I'd like after running the script:
dfgsdfg sdfgsd fgsdfgsdf gsdfg sdfgadfs dgdghs dfdfgg fghf dfgh dfgh

I've used this script, and variations of it, to remove these characters: +
CRLF.
It removes the + char, but still leaves each ini entry split into multiple
lines.

I've also searched the archives for a solution, nothing is working.

Any ideas?


My script:
####
on mouseUp
--clear current fields on card
--these fields are so that I can see the results from the script.
put empty into fld "Orig"
put empty into fld "Changed"

--fetch the file
put "C:/temp/some.ini" into tFilename
put URL ("file:" & tFilename) into tData
put tData into fld "Orig"

repeat for each line L in tData
--grab the line
put L into tLine

--If the line contains +, then it will also contain CR and LF,
--so only work on a line with +.
if (tLine contains "+") then
--find + and delete it
put offSet("+",tLine) into tPos
delete char tPos to tPos in tLine

--find CR and delete it
put offSet(CR,tLine) into tPos
delete char tPos to tPos in tLine

--find LF and delete it
put offSet(LF,tLine) into tPos
delete char tPos to tPos in tLine

--put the line into a container so that I can see the results
put tLine & cr after theLines
else -- just put the line into a container
put tLine & cr after theLines
end if
end repeat

put theLines into fld "Changed"
end mouseUp
####

Regards,
Mark Stuart
-- 
View this message in context: http://www.nabble.com/Removing-CRLF-from-text-tp18862004p18862004.html
Sent from the Revolution - User mailing list archive at Nabble.com.

_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

To: use-revolution at lists.runrev.com



More information about the use-livecode mailing list