Jump to content


This topic is now archived and is closed to further replies.


Using ltrim and rtrim to get a specifc string?

Recommended Posts

I have a set of infomation in the following format. This is an example - the data might not always be in this exact orfder and there may be more or less infro in this memo field.

bPhone='m: 555 55555;'

What I need to do is be able to pull that info into a var (say $blah) and then trim the info either side of a partiular pattern such as 'pSBDate={%/%/%}' so that all that I end up with a var with only that bit of data in it.

I'm not sure if this is totally clear but if you think you can help please let me know and I'll try and clarify any points that are not well explained.

Thanks for any and all help!

Share this post

Link to post
Share on other sites
trim is a function to remove whitespace from the beginning and/or ends of a string, it seems like you just want to have a string with all that info in it and be able to pull any of the data out of it at a given time, why not use an array? Unless I'm misunderstanding you.

If it must be a string though, you can probably use preg_replace to return only the string you want.

Share this post

Link to post
Share on other sites


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.