FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » PHP Concatenate
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: PHP Concatenate [message #178198 is a reply to message #178197] Tue, 22 May 2012 14:21 Go to previous messageGo to previous message
Paul Herber is currently offline  Paul Herber
Messages: 26
Registered: February 2011
Karma:
Junior Member
On Tue, 22 May 2012 08:42:54 -0500, "Peter H. Coffin" <hellsop(at)ninehells(dot)com> wrote:

> On Tue, 22 May 2012 08:21:27 -0400, Jerry Stuckle wrote:
>> On 5/21/2012 3:19 PM, Luuk wrote:
>>> On 21-05-2012 20:47, Kevin Davis wrote:
>>>> Hi there,
>>>>
>>>> Here is what I'm trying to do.. I'm trying to merge the first and
>>>> last name (that I can do) into an email address. But what I'm
>>>> trying to do is to drop the middle initial. If the entry was from a
>>>> form, I would have no problem, but the data will be uploaded from a
>>>> different source, how would I go about dropping the middle initial?
>>>>
>>>> Would I use regex??
>>>>
>>>> Thank you,
>>>> Kevin
>>>
>>> $name="Kevin R. Davis";
>>> $a=split(" ",$name);
>>> print $a[0]." ".$a[count($a)-1];
>>>
>>> It should print:
>>> Kevin Davis
>>
>> What about "John Smith Jr"?
>
> Or "Carlos Salinas de Gortari"?
>
> To cut to the important point, "dropping middle initial" is a kind
> of simple problem surround by worm-cans with very weak lids. Pretty
> much the least damaging thing you can do is drop punctuation and any
> single-letter (not single character, just Latin letter) words, using two
> passes with regexp processing. Usually if someone has put something into
> a field on form asking for their name, whatever they've put there is
> important to them.
>
> You'll still piss off will.i.am of The Black-Eyed Peas even with that
> simple step.

and anyone with the surname De'Ath.



--
Regards, Paul Herber, Sandrila Ltd.
http://www.sandrila.co.uk/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: implode/explode vs serialize/unserialize
Next Topic: Google groups - melhoria da plataforma
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 16:57:46 GMT 2024

Total time taken to generate the page: 0.03985 seconds