Jump to content
Sign in to follow this  
Dolemite50

String Replace in file..is array necessary?

Recommended Posts

Dolemite50

Hi,

I'm attempting a recursive string replace in files. Most examples I've found read the file to an array and then step through each line performing the replace. It works like a champ, however, somewhere I saw an example where functions were being parsed from a file directly from the fileread (using RegExp). In other words, the entire file was treated as a single string. Does anybody know of any replace examples using that method? Any pros or cons?

Thanks for reading, and for any advice.

Share this post


Link to post
Share on other sites
memoryoverflow

ah, that's nice, missed the FileRead...

As for handling it as a single string, you can still have a look here.


(The signature is placed on the back of this page to not disturb the flow of the thread.)

Share this post


Link to post
Share on other sites
dantay9

A pro is definately the speed. StringRegExp is much faster than reading from an array. It also doesn't use loops or anything like that. A con may be it is a bit difficult to read if you aren't well versed with StringRegExp (at least in my opinion). A simple comment next to the line would fix that though.

Personally, I like StringRegExp a lot more than arrays.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.