This tool converts groups of consecutive spaces in your code into a specified number of tab characters. Simply enter your code, specify the number of consecutive spaces to match, and the number of tabs to output. Then process your text to convert each matching group of spaces into the desired number of tab characters.
Examples:
Example 1: 4 Spaces to 1 Tab
Every occurrence of 4 consecutive spaces is replaced with 1 tab.
function test() { return true; }
function test() { return true; }
Example 2: 2 Spaces to 1 Tab
Every occurrence of 2 consecutive spaces is replaced with 1 tab.
if (x) { return x; }
if (x) { return x; }
Example 3: 3 Spaces to 2 Tabs
Every occurrence of 3 consecutive spaces is replaced with 2 tabs.
let x = 5;
let x = 5;
Example 4: 8 Spaces to 1 Tab
Replaces every occurrence of 8 consecutive spaces with 1 tab.
console.log("8 spaces");
console.log("8 spaces");
Example 5: 5 Spaces to 2 Tabs
Every group of 5 consecutive spaces is replaced with 2 tabs.
console.log("5 spaces");
console.log("5 spaces");
Example 6: 4 Spaces to 3 Tabs
Replaces every occurrence of 4 consecutive spaces with 3 tabs.
console.log('More tabs');
console.log('More tabs');
Example 7: 6 Spaces to 1 Tab
Every occurrence of 6 consecutive spaces is replaced with 1 tab.
if(condition){ doSomething(); }
if(condition){ doSomething(); }
Example 8: 1 Space to 1 Tab
Every single space is replaced with a tab. (This example is more experimental.)
code
code
Example 9: 3 Spaces to 1 Tab
Every occurrence of 3 consecutive spaces is replaced with 1 tab.
while(true) { break; }
while(true) { break; }
Example 10: 7 Spaces to 2 Tabs
Every occurrence of 7 consecutive spaces is replaced with 2 tabs.
switch(value) { case 1: break; }
switch(value) { case 1: break; }