How to remove extra spaces in a row??

Reply

Join Date: Aug 2008
Posts: 28
Reputation: Vandithar is an unknown quantity at this point 
Solved Threads: 0
Vandithar Vandithar is offline Offline
Light Poster

How to remove extra spaces in a row??

 
0
  #1
Jun 2nd, 2009
Hi,

I have a table like this:

  1.  
  2. name
  3. +------------------------------------+
  4. | name |
  5. +------------------------------------+
  6. | This IS an rna-binding protein. The data which IS useful IS available FROM the desired location. |
  7. +------------------------------------+
  8. 1 row IN SET (0.00 sec)

I want to remove extra space i.e in between binding and protein, desired and location, useful and this.

I tried with trim function but that didn't remove these spaces.

There should be only one space in between binding and protein, desired and location, useful and this.

Output should be like this:

  1.  
  2. SELECT * FROM remove;
  3.  
  4. +--------------------------------+
  5. | name |
  6. +--------------------------------+
  7. | This IS an rna-binding protein. The data which IS useful IS available FROM the desired location |
  8. +--------------------------------+
  9. 1 row IN SET (0.00 sec)

How can i remove extra spaces???

Any suggestions??

Regards
Vanditha
Last edited by Vandithar; Jun 2nd, 2009 at 6:41 am.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 11
Reputation: k8f1 is an unknown quantity at this point 
Solved Threads: 1
k8f1 k8f1 is offline Offline
Newbie Poster

Re: How to remove extra spaces in a row??

 
-1
  #2
Jun 2nd, 2009
Hi,

Could you copy and paste your code? Have you used any css?

Thanks
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 28
Reputation: Vandithar is an unknown quantity at this point 
Solved Threads: 0
Vandithar Vandithar is offline Offline
Light Poster

Re: How to remove extra spaces in a row??

 
0
  #3
Jun 2nd, 2009
Originally Posted by k8f1 View Post
Hi,

Could you copy and paste your code? Have you used any css?

Thanks

Hi,

I am not using css!

This is the data i.e in my table.

  1. name
  2. +------------------------------------+
  3. | name |
  4. +------------------------------------+
  5. | This IS an rna-binding protein. The data which IS useful IS available FROM the desired location. |
  6. +------------------------------------+
  7. 1 row IN SET (0.00 sec)

I tried with trim function like this:

  1. UPDATE remove SET name = TRIM(name);

but didn't work!!!

How can i remove these spaces??


Regards
Vanditha
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 11
Reputation: saurav.prasad28 is an unknown quantity at this point 
Solved Threads: 0
saurav.prasad28 saurav.prasad28 is offline Offline
Newbie Poster

Re: How to remove extra spaces in a row??

 
0
  #4
Jun 2nd, 2009
Originally Posted by Vandithar View Post
Hi,

I am not using css!

This is the data i.e in my table.

  1. name
  2. +------------------------------------+
  3. | name |
  4. +------------------------------------+
  5. | This IS an rna-binding protein. The data which IS useful IS available FROM the desired location. |
  6. +------------------------------------+
  7. 1 row IN SET (0.00 sec)

I tried with trim function like this:

  1. UPDATE remove SET name = TRIM(name);

but didn't work!!!

How can i remove these spaces??


Regards
Vanditha

Hi Vanditha

you are right when u used the trim it's not worked because trim is used only when the white space in left side or right side. so use regexp for this issue.

Regards
Saurav Prasad
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 822
Reputation: verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough 
Solved Threads: 73
verruckt24's Avatar
verruckt24 verruckt24 is offline Offline
Practically a Posting Shark

Re: How to remove extra spaces in a row??

 
0
  #5
Jun 3rd, 2009
Could you copy and paste your code? Have you used any css?
so use regexp for this issue.
Whats code got to do with it ? And what the hell is the css doing there in a question related to MySQL ? And how are you going to use regex Mr. ? If you don't know the answer don't post there's no point in pointing someone in the wrong direction or even asking unnecessary questions.

@OP : Use the REPLACE function in MySQL.
http://dev.mysql.com/doc/refman/5.0/en/replace.html
Get up every morning and take a look at the Forbes' list of richest people. If your name doesn't appear.... GET TO WORK !!!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC