You are here: Re: [PHP] Re: Question about "shortening" a string « PHP « IT news, forums, messages
Re: [PHP] Re: Question about "shortening" a string

Posted by Ashley M. Kirchner on 10/04/88 11:10

Mário Gamito wrote:

> Hi Sokolewicz,
>
> Thanks a lot.
> It just working really fine :)
>
> M. Sokolewicz wrote:
>
> > Mário Gamito wrote:
> >
> >> For example, if i fill the form with "Mário Augusto Machado dos
> Reis Gamito", i want to change this string to only "Mário Gamito".
> >>
> >> The total number of names is not fix.
> >> Could be 3, 4, 5, 6,...
> >>
> >> Does anyone knows how to do this ?
> >
> > <?php
> > $parts = explode(' ', $fullName);
> > $shortenedName = $parts[0].' '.$parts[count($parts)-1];
> > ?>
> >
>
This might solve one problem. What about people who have names like
'Pablo Ricardo del Rey' where you can't simply pick first and last
because their last name really is 'del Rey'. Or 'von Braun', or ...you
get the idea.

--
H | I haven't lost my mind; it's backed up on tape somewhere.
+--------------------------------------------------------------------
Ashley M. Kirchner <mailto:ashley@pcraft.com> . 303.442.6410 x130
IT Director / SysAdmin / WebSmith . 800.441.3873 x130
Photo Craft Imaging . 3550 Arapahoe Ave. #6
http://www.pcraft.com ..... . . . Boulder, CO 80303, U.S.A.

 

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

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