You are here: Re: Delete multiple spaces and special characters « PHP Programming Language « IT news, forums, messages
Re: Delete multiple spaces and special characters

Posted by Kimmo Laine on 08/29/05 15:35

"kerul4u" <kerul4u@gmail.com> wrote in message
news:1125318171.067211.108700@z14g2000cwz.googlegroups.com...
> Try this simple yet powerfull solution
>
> //Your String
> $string = "a&*bbb cc/c d!d";
>
> //Array of special charecters you want to replace
> $special = array('/','!','&','*'); //here you can add as many char. you
> want
> $replacements = "";
>
> echo str_replace($special,'',$string);
>


That still doesn't remove multiple spaces, ie. whitespace. Some regexp
wizard kid could tell how the whitespace is replaced with a single space.
I'd say that converting the spcial chars would be easy too with regular
expressions.

The thing is I'm all thumbs with regexp so I can only recommend using it but
I have no idea how it would work ;)

--
Welcome to Usenet! Please leave tolerance, understanding
and intelligence at the door. They aren't welcome here.
eternal piste erection miuku gmail piste com

 

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

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