You are here: Re: removing whitespaces « PHP Programming Language « IT news, forums, messages
Re: removing whitespaces

Posted by Janwillem Borleffs on 02/27/06 23:07

rj wrote:
> This works great, but makes no handles all characters in the same
> way. I want to preserve data between double quotes. So,
> hello world "It is a sunny... world"
> shall be reduced to
> hello world "It is a sunny... world"
>
> and should not remove the whitespaces between the quotes.
>

$str = 'hello world "It is a sunny... world"';

function cb($m) {
if (trim($m[1])) {
return $m[1];
}
return ' ';
}
$str = preg_replace_callback('/(\s+|"[^"]+")/','cb', $str);


JW

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация