RE: [PHP] remove last character in a string
| From: | Matthew Walker | Date: | Tue, 23 Apr 2002 04:29:11 +0000 |
| Subject: | RE: [PHP] remove last character in a string | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-94110@lists.php.net to get a copy of this message | ||
Actually, if he uses a negative index in substr(), he doesn't need to
know the length of the string.
Matthew Walker
Senior Software Engineer
ePliant Marketing
-----Original Message-----
From: Tyler Longren [mailto:tyler@captainjack.com]
Sent: Monday, April 22, 2002 9:29 PM
To: Craig Westerman; php-general-list
Subject: Re: [PHP] remove last character in a string
First, you'll need to get the length of the str with the str_len()
function.
After you have that, use the substr() function like Rasmus mentioned.
Tyler Longren
Captain Jack Communications
www.captainjack.com
tyler@captainjack.com
----- Original Message -----
From: "Craig Westerman" <westerman@chanuteks.com>
To: "php-general-list" <php-general@lists.php.net>
Sent: Monday, April 22, 2002 10:26 PM
Subject: [PHP] remove last character in a string
> I have a string that ends in a comma. What is best method to remove
the
> comma?
>
> Craig ><>
> westerman@chanuteks.com
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.345 / Virus Database: 193 - Release Date: 4/9/2002