Jump to content


Using ltrim and rtrim to get a specifc string?

  • Please log in to reply
1 reply to this topic

#1 TheFunkeyGibbon

  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 15 March 2006 - 12:08 PM

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!

#2 k.soule

  • Members
  • PipPipPip
  • Advanced Member
  • 30 posts
  • LocationIllinois

Posted 15 March 2006 - 12:54 PM

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.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users