Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Extracting the first word
Old 04-17-2005, 10:07 AM Extracting the first word
fambi's Avatar
Ultra Talker

Posts: 339
Trades: 0
Anyone have any idea on how to extract the first word in a string?

Please bear in mind the first word could be followed by any non-alphanumeric character such as a space, comma or question mark (for example).
__________________

Please login or register to view this content. Registration is FREE
from a
Please login or register to view this content. Registration is FREE
is easy!
Read this
Please login or register to view this content. Registration is FREE
that uses our
Please login or register to view this content. Registration is FREE
.
fambi is offline
Reply With Quote
View Public Profile Visit fambi's homepage!
 
 
Register now for full access!
Old 04-17-2005, 02:29 PM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
erm i think there is, try using this, i use it to split dates down into days, months and years using many different seperators

PHP Code:
list($first_word$utter_crap) = split('[ ?,]'$string); 
So the first word would be extracted to $first_word (suprise suprise!) and $utter_crap is the rest of the string.

[ ?,] is where we specifiy the seperators, but i'm not sure about the space bit

Try it.
__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill

Please visit my sites:
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 04-17-2005, 03:14 PM
fambi's Avatar
Ultra Talker

Posts: 339
Trades: 0
Cool! It seems to work fine!

Thanks.
__________________

Please login or register to view this content. Registration is FREE
from a
Please login or register to view this content. Registration is FREE
is easy!
Read this
Please login or register to view this content. Registration is FREE
that uses our
Please login or register to view this content. Registration is FREE
.
fambi is offline
Reply With Quote
View Public Profile Visit fambi's homepage!
 
Reply     « Reply to Extracting the first word
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26760 seconds with 12 queries