Author Topic: How to convert tabs to spaces without extra text modification  (Read 7478 times)

Offline Cypress

  • Single posting newcomer
  • *
  • Posts: 2
Sorry for my bad english.
Needed only tabs to spaces conversion, but when i am using AStyle plugin with custom settings and only "Convert TABs to spaces" selected result is:
Before

if( expression )
{
    return 1;
}


After

if ( expression )
{
    return 1;
}

What about space after if? Workarounds, another ways to solve this problem?


Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: How to convert tabs to spaces without extra text modification
« Reply #1 on: June 05, 2008, 03:49:14 pm »
(as much as i hate to state the obvious) search and replace?

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: How to convert tabs to spaces without extra text modification
« Reply #2 on: June 05, 2008, 05:13:10 pm »
Needed only tabs to spaces conversion, ...

Have you heard of a nice utility called Swiss File Knife? Use it and you can convert Tabs-to-Spaces without loosing formatting. Download it from-

Quote
http://sourceforge.net/project/showfiles.php?group_id=160478

To convert tabs to spaces, type the following command at command prompt.

Code
sfk detab=4 <filename>

It will replace each Tab with 4 spaces.
Be a part of the solution, not a part of the problem.

Offline Cypress

  • Single posting newcomer
  • *
  • Posts: 2
Re: How to convert tabs to spaces without extra text modification
« Reply #3 on: June 05, 2008, 08:00:17 pm »
Thank you very much. 'sfk' works wery well, without lossing formatting. Tabs was converted AND columns of text is correctly aligned  :D:

Code
#define US_SC_RBC   0x01
#define US_SC_8020  0x02
#define US_SC_QIC   0x03

search->replace... is works too, but code look messy:

Code
#define US_SC_RBC    0x01
#define US_SC_8020    0x02
#define US_SC_QIC    0x03


rodrigoluis

  • Guest
Re: How to convert tabs to spaces without extra text modification
« Reply #4 on: September 30, 2016, 06:03:39 pm »
I know this topic is old, but if someone is looking to convert tab to spaces easily, maybe this site could help:
http://tabstospaces.com/