Well, do a strlen() on it to see how long it actually is.  I bet you have
all sorts of stuff trailing that thing.  Or you are just making some other
really silly mistake.

-Rasmus

On Wed, 21 Aug 2002, Mike At Spy wrote:

>
> Get this - it didn't work!  :(
>
> I tried decreasing the -1 to -2 and so on, but nothing on that either.  :(
>
> -Mike
>
>
>
> > -----Original Message-----
> > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, August 20, 2002 12:45 PM
> > To: Mike At Spy
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP] Agh! trim (#$@#@^%!!!)
> >
> >
> > Well, perhaps you have something after the . in that string?
> >
> > You can strip off the last char of a string very simply with:
> >
> >    substr($str,0,-1)
> >
> > -Rasmus
> >
> > On Tue, 20 Aug 2002, Mike At Spy wrote:
> >
> > >
> > > Hey!
> > >
> > > :)
> > >
> > > I have an issue with trim / triml.  Whenever I put a string in
> > to trimmed,
> > > it refuses to take the period at the end of the string off.
> > >
> > > I did put more things to trim first, but this is basically what
> > I am doing:
> > >
> > >
> > > $single = "The date is 20-Aug-2002." // This is an example - see below
> > > $trimmed = rtrim($date, ".");
> > >
> > >
> > > Is there an issue with this?  I've tried using trim() too.
> > >
> > > The source of $single is a reponse from a server.  I should
> > note that when I
> > > put this in as an experiment, it works fine.  When I get the
> > line from the
> > > server, it doesn't work!
> > >
> > > The only thing I can think of is the possibility that the "." I
> > am seeing at
> > > the end of the line isn't really one (it looks like a duck,
> > copies like a
> > > duck, but...isn't a duck??!!).
> > >
> > > Is there a way to just strip the last character off regardless
> > of what it
> > > is?
> > >
> > > Thanks,
> > >
> > > -Mike
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to