Connecting Tech Pros Worldwide Help | Site Map

string :extract fullname

Newbie
 
Join Date: Apr 2007
Posts: 10
#1: Apr 23 '07
How do you extract full name by looking for the space to get just the first name by itself and the last name by it self by using call by reference without using if or else
Ganon11's Avatar
Moderator
 
Join Date: Oct 2006
Location: New York, United States of America
Posts: 3,428
#2: Apr 23 '07

re: string :extract fullname


By using the string's .find() function.
Newbie
 
Join Date: Apr 2007
Posts: 10
#3: Apr 23 '07

re: string :extract fullname


Quote:

Originally Posted by Ganon11

By using the string's .find() function.

but I don' t know how to find the empty space to exract the first name from last name by using the string find()

since user can input any name they wish.
AdrianH's Avatar
Expert
 
Join Date: Feb 2007
Location: Halifax
Posts: 1,099
#4: Apr 23 '07

re: string :extract fullname


Quote:

Originally Posted by oi123

but I don' t know how to find the empty space to exract the first name from last name by using the string find()

since user can input any name they wish.

Hi Oi,

Try using find_first_of() to find the spaces.


Adrian
Reply