Re: Easy question - delete strings from the beginning of space...

From: Date: Tue, 20 Sep 2005 13:04:24 +0000
Subject: Re: Easy question - delete strings from the beginning of space...
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-222758@lists.php.net to get a copy of this message
----- Original Message ----- From: "Jochem Maas" <jochem@iamjochem.com> To: "Gustav Wiberg" <gustav@varupiraten.se> Cc: "PHP General" <php-general@lists.php.net> Sent: Tuesday, September 20, 2005 2:24 PM Subject: Re: [PHP] Easy question - delete strings from the beginning of space...
Gustav Wiberg wrote:
Hi there! I guess this is an easy question. I have string... "Hello you" and I want to get the "Hello" part. How do I do that? (I can of course search for first occurence of space and then use substr, but I guess there is an easier solution?
how much easier do you want it? oh and guessing kinda sucks. $str = "Hello World"; $words = explode(" ", $str); echo $words[0]; ... but what if you have double spaces, or a space at the beginning?
/G http://www.varupiraten.se/
-- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.11.3/106 - Release Date: 2005-09-19 Hi there!
Ok, I'll think I do it in my way because of double spaces etc... Thanx anyway! /G http://www.varupiraten.se/ ps. Forgive me for guessing... :-)

« previous php.general (#222758) next »