SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    377
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question how to remove a price from the end of a paragraph of text!!

    Hello

    I'm looking for a way to remove a price from the end of a paragraph of text.
    I've looked at rtrim but I can't work out how to get it to find the sign and remove it plus everything to the right of this in a string!
    Can anyone please help with this?

    Thanks in advance!

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    4,810
    Mentioned
    141 Post(s)
    Tagged
    0 Thread(s)
    Can you provide examples of the paragraph you will receive and the output you expect?
    Be sure to congratulate xMog on earning April's Member of the Month
    Go ahead and blame me, I still won't lose any sleep over it
    My Blog | My Technical Notes

  3. #3
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    377
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,

    Here's an example of the text I need to remove the price at the end from:

    Tyre condition Good, Standard Features - Elektra cloth upholstery, Manual height adjustable front seats, Power assisted steering, Silver interior trim, Smokers pack, 16 double spoke alloy wheels style 222, BMW Business radio with single CD player, Solid paint, Reach + rake adjustable steering column, Body colour bumpers, Front head restraints, Dynamic brake control, Seat belt force limiter, Inflatable Tubular Structure head airbags for front/rear, 3 spoke sports leather steering wheel, 60/40 split rear seats, Driver/Passenger airbags (Impact dependent), Multifunction steering wheel with audio controls, Front isofix attachment + airbag deactivation, On board diagnostics, CBC - (Cornering brake control), Thatcham Category 1 alarm, Crash sensor, Front fog lights, Remote central locking, On board computer, Experian auto check clear. £10,250

    Any ideas?

    Thanks

  4. #4
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    4,810
    Mentioned
    141 Post(s)
    Tagged
    0 Thread(s)
    Okay, so if you know it will always be at the end, I'd suggest using substr with strrpos

    PHP Code:
    $textWithoutPrice substr($text0strrpos($text'£')); 
    Be sure to congratulate xMog on earning April's Member of the Month
    Go ahead and blame me, I still won't lose any sleep over it
    My Blog | My Technical Notes

  5. #5
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    377
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Genius!!
    Works perfectly! thanks for the help with this.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •