![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Nov 2007
Posts: 26
Rep Power: 0
![]() |
Removing double spaces with str_replace
I want to replace double spaces with single spaces.
I have been able to do this before : php Syntax (Toggle Plain Text)
this worked or I thought it did anyway with other strings but I'm guessing there's something in the problem string that I'm not seeing anyway to get to the point this is what I have: php Syntax (Toggle Plain Text)
the code above echoes the same before and after the str_replace command. What am I missing? it's definitely two spaces but as you can see I've even tried replacing a tab in case that's what it was... Are there any other characters it could be??? |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,787
Rep Power: 5
![]() |
Re: Removing double spaces with str_replace
Are you positive that it's what comes from the database? Output it and then check the HTML (not what appears in the browser). This is because it could be using " " for a space, which appears to be a space in your browser, but is not the case in the data.
There could also be a newline, or something else. So make sure you're comparing it to the outputted HTML. |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Nov 2007
Posts: 26
Rep Power: 0
![]() |
Re: Removing double spaces with str_replace
Thanks. I'll try that when I get back to work on Monday.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Difference between double and Double in C# | jonyzz | C# | 14 | Jan 18th, 2007 6:38 AM |
| double functions (getting weird numbers) | j0nathan | C++ | 4 | Apr 5th, 2006 2:53 AM |
| How do i use a ^ for a double variable? | dvu | C# | 4 | Feb 3rd, 2006 9:27 AM |
| Problem converting double to int | Jared | C++ | 2 | Feb 18th, 2005 1:53 AM |