Re: Splitting string

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

 



I think the easiest way, if you can guarantee exactly 50 spaces as the 
separator, is to simply explode() it.

$string = "EVOLUTION                                         DEAR GOD
BOYZ_II_MEN                                       ";

$arr = explode(str_repeat(' ', 50), $string);

You could also use a regex, but that's probably overkill if your separator is 
that simple.  If it's not, then you may need a regex.

On Sunday 10 December 2006 02:41, Steven Macintyre wrote:
> Hello,
>
> (a) I don't have php 5 :)
>
> (b) I have tried to use a < php 5 snippet from manual to no success ...
>
>
> I have a string like such ... "word                 another word
> yet another"
>
> Now ... from word to another word (excluding another word, including word)
> is 50 chars ... and the same fro another word to yet another ...
>
> I need to split this string and get those three "fields"
>
> I manage to get the first section right ...
>
> Example of string;
>
> $string = "EVOLUTION                                         DEAR GOD
> BOYZ_II_MEN                                       ";
>
> Will someone be able to assist me?
>
> I cannot strip spaces as some of the "words" will be double ... ie "Dear
> God" etc
>
>
> Kind Regards,
>
>
> Steven Macintyre
> http://steven.macintyre.name
> --
>
> http://www.friends4friends.co.za

-- 
Larry Garfield			AIM: LOLG42
larry@xxxxxxxxxxxxxxxx		ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

-- 
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