Removing CRLF from text

Randy Hengst iowahengst at mac.com
Thu Aug 7 07:30:25 EDT 2008


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



More information about the use-livecode mailing list