Home » Support » Tutorials/Power Tips » UltraEdit » Tabs to Spaces - Ignore tabs and spaces in string and comments
IDM Power Tips

Tabs to Spaces - Ignore tabs and spaces in string and comments

Ever had to convert the tab characters to spaces, but wanted to leave the tabs in strings and comments untouched? In previous versions, the convert tabs to spaces feature didn't distinguish between tabs as whitespace/formatting vs. tabs in string/comments. Those days are gone... UltraEdit/UEStudio can be optionally configured to convert the whitespace/formatting tabs but leave the tabs in strings/comments untouched.


Ignore spaces and tabs inside comments and string

By default, the convert tabs to spaces (or spaces to tabs) feature will convert all tabs and/or spaces; however, you can optionally configure UltraEdit/UEStudio to ignore the tab/space charaters in comments and strings.

For the purposes of this power tip, we are using a tab/space value of 4. We have also enabled the View Spaces/Tabs in the View menu. The tabs are represented by the chevron (»), the spaces are represented by the dot (•).

As demonstrated in the following screenshot, the sample code includes tabs as "formatting". The code also includes tabs inside strings. The output for the PHP sample file is a type of CSV file - delimited with tabs - so it is important that the tabs inside the string characters remain untouched by the conversion.

Ignore String Literals

Now, to enable support for the "ignore" feature, go to Advanced : Configuration : Editor Display : Formatting and check (enable) the setting for "Do not convert spaces and tabs inside comments and strings". This will tell UltraEdit/UEStudio to convert the whitespace/formatting tabs (or spaces) but ignore the tabs (or spaces) in comments and strings.

Ignore String Literals

After setting the "ignore" option, click on the "Tabs to Spaces" option in the Format menu.

Ignore String Literals

You should see that the formatting tabs are converted to spaces but the tabs inside the strings remain untouched.

Ignore String Literals

Back to power tips index

Cnet/Download.com
"We won't mince words:
UltraEdit is outstanding..."

Corporate Licensing

It's easy to purchase corporate licensing from us!

  • Bulk/quantity discounts
  • Enterprise/plant/site licensing
  • Purchase with PO or invoice

The new UltraSuite

The only fully integrated solution of its kind!

Four powerful applications: UltraEdit, UltraCompare, UltraFinder, and UltraSentry!

Save over 33% when you bundle with the UltraSuite!

Power of Portable

Now supporting PortableApps!

UE/UC Mobile

Unleash the power of the total file management solution on your flash drive!