I need to process a big TXT file which contains notes from the orders.
Some notes look like Note for an order
, other ones like "Note for an order"
. I would need to remove the "
char from the respective string, if is in the begining and in the end of string.
Because the file is pretty large (±10MB), what is the fastest way to do it? What would you recommend me?
Check each line as you get it from the file. I assume you are reading it in line by line - or if you are reading it in chunks (or the whole file) you are processing it line by line. In that case when you get the line and pop it into a $var
you can do something like this with trim():
$var=trim($yourLineOrColumn, '"');
and then deal with $var
instead.