Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Right Trim Comma

Status
Not open for further replies.

PCHomepage

Programmer
Feb 24, 2009
609
US
How can I remove a right comma from a string? I would have expected to be able to use rtrim() (or even trim()) but nothing seems to happen and the comma remains:

Code:
echo rtrim($String, ',');

 
I am answering my own question as the reason it won't trim is that it isn't the last character in the string - it has a blank space after it so this is what was needed:

Code:
echo rtrim($String, ', \t\n');
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top