Jump to content

Recommended Posts

I have searched around for this and haven't really found anything except for the substr() function which doesn't work in this situation. Basically I want to use the trim() function to trim out a string of "ABC", yet when I use a function like this:

 

trim($file, "ABC");

 

on for example:

 

"A TEST B TEST C"

 

It will result in " TEST TEST " because it is stripping the characters rather than a full string. Does anybody know a way to do this? Thanks!

 

Link to comment
https://forums.phpfreaks.com/topic/139760-trimming-based-on-string-not-characters/
Share on other sites

Well, actually, it results in "TEST B TEST".  trim() actually just makes a character mask of the characters in the 2nd parameter and uses that to pull the left and right characters off and stuff.  What are you trying to do?  Remove a specific string from the end of a line?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.