FUDforum - خوراک RDF
http://fudforum.org/forum/index.php
PHP Concatenate
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=178190&th=122678#msg_178190
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]]>Kevin Davis2012-05-21T18:47:01-00:00Re: PHP Concatenate
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=178192&th=122678#msg_178192
> 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
I really hate to ask these because I fear the answers:
will there always be a middle initial ?
Will there be any first or last names with embedded spaces ? (eg
Jean Paul Aloysius Smith ?
bill]]>bill2012-05-21T19:17:08-00:00Re: PHP Concatenate
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=178194&th=122678#msg_178194
> 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]]>Luuk2012-05-21T19:19:37-00:00Re: PHP Concatenate
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=178195&th=122678#msg_178195
> 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??
You might if you wanted and if the full problem had a decent regex
solution to match it. However as Bill and Luuk have shown, you have
not given enough data in order for us to evaluate it.]]>Captain Paralytic2012-05-22T11:34:23-00:00Re: PHP Concatenate
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=178196&th=122678#msg_178196
> 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"?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attglobal.net
==================]]>Jerry Stuckle2012-05-22T12:21:27-00:00Re: PHP Concatenate
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=178197&th=122678#msg_178197
> 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.
--
Never correct Halloween decorations where the guidance counselor can see.
It makes for very tedious conversations later.]]>Peter H. Coffin2012-05-22T13:42:54-00:00Re: PHP Concatenate
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=178198&th=122678#msg_178198
hellsop@ninehells.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/]]>Paul Herber2012-05-22T14:21:08-00:00Re: PHP Concatenate
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=178199&th=122678#msg_178199
> On Tue, 22 May 2012 08:42:54 -0500, "Peter H. Coffin" <hellsop@ninehells.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.
>
>
He assisted with my late mothers will, did Mr De'Ath. Genuinely!
>
--
To people who know nothing, anything is possible.
To people who know too much, it is a sad fact
that they know how little is really possible -
and how hard it is to achieve it.]]>The Natural Philosoph2012-05-22T15:37:50-00:00Re: PHP Concatenate
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=178202&th=122678#msg_178202
> On Tue, 22 May 2012 08:42:54 -0500, "Peter H. Coffin" <hellsop@ninehells.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.
>
>
>
But, of course, this method is not perfect and/or complete.
But where is the OP.....?
Why does not he/she give a clue about what is expected?]]>Luuk2012-05-22T18:18:41-00:00Re: PHP Concatenate
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=178203&th=122678#msg_178203
> On Tue, 22 May 2012 08:42:54 -0500, "Peter H. Coffin" <hellsop@ninehells.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.
>
>
>
// Second solution, so J. R. R. Tolkien is also handled correctly
$name="J. R. R. Tolkien";
$a=split(" ",$name);
for ($f=0; $f<count($a); $f++)
if (substr($a[$f],strlen($a[$f])-1,1)!="." or $f==0) print
$a[$f]." ";
print "\n";
?>
output:
Kevin De'Ath
J. Tolkien]]>Luuk2012-05-22T18:30:45-00:00Re: PHP Concatenate
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=178329&th=122678#msg_178329
Nick Brooks2012-06-05T06:33:31-00:00