Jump to content

Using ltrim and rtrim to get a specifc string?


TheFunkeyGibbon

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.

pMADate={25/04/2005}
pSBDate={25/04/2005}
pexchfcst={31/05/2005}
bPhone='m: 555 55555;'
bsAttn=1
pCompDate={28/10/2005}

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!
Link to comment
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.
Link to comment
Share on other sites

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.