RE: [PHP-WIN] Stripping returns _SOLVED
| From: | George Pitcher | Date: | Mon, 29 Mar 2004 10:34:46 +0000 |
| Subject: | RE: [PHP-WIN] Stripping returns _SOLVED | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-23294@lists.php.net to get a copy of this message | ||
Sorry guys, its OK now. I was checking an earlier output (too many
interruptions at work).
Ta.
George
> -----Original Message-----
> From: George Pitcher [mailto:george.pitcher@ingenta.com]
> Sent: 29 March 2004 11:31 am
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] Stripping returns
>
>
> 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
>
>