Stripping returns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I'm using php to create java classes for database access. I have a file (a
few in fact) containing a list of fieldnames, one per line.

So I open the file and read it line by line and create the java code.
Opening reading and closing is repeated for the several stages of definition
and setting methonds etc.

The problem is that as well as reading the fieldname, it is adding a
'return' at the end of it. It wouldn't take long to clean up but I've got
about 20 of these classes to create and some have more than 300 fields
(after normalisation).

I read the file like so:
=============================================
$fd = fopen ($filename, "r");
while (!feof ($fd)) {
    $buffer = fgets($fd, 4096);
    $buffer = str_replace("\n","",str_replace("\r","",$buffer)); <<<< How I
tried to sort it
    $content.= "\tprivate String _".$buffer." = \"\";\r\n";
}
fclose($fd);
=============================================
Producing :
- - - - - - - - - - - - - - - - - - - - - - -
	private String _bl_serials
 = "";
- - - - - - - - - - - - - - - - - - - - - - -

It does build the code nicely apart from this one flaw.

Any suggestions?

MTIA

George in Oxford

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux