RE: Splitting string

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

 



Hi,

> Ah, so it's not 50 space padding but columns at 50 characters,
> space-padded?
> 
> In that case, just use substr().
> 
> $var1 = substr($string, 0, 50);
> $var2 = substr($string, 50, 50);
> $var3 = substr($string, 100, 50);
> 
> And then trim() if needed
> 
> Of course, what it sounds like you really want is a file that is
> formatted to
> proper CSV in the first place so that you can use fgetcsv().
> 

Brilliant! Works fab ... thank you ...

The file will always be the same format etc - so I this is brilliant...

Ta

Steven

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux