Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?

Indent/Unindent Text

Description
Use this Macro to indent or unindent text. Use a positive value for indentSize to indent (move text to the right by 1 tab), use a negative value to unindent (move text to the left by 1 tab).
Language
C#.net
Minimum Version
Created By
Splat
Contributors
-
Date Created
Aug 19, 2014
Date Last Modified
Aug 19, 2014

Macro Code

using System;
using System.Text.RegularExpressions;

public static class ClipboardFusionHelper
{
    public static string ProcessText(string text)
    {
        int indentSize = 1; //Use negative or positve values
        char indentChar = '\t'; //Tab character

        if (indentSize > 0)
            text = Regex.Replace(text, @"^", new string(indentChar, indentSize), RegexOptions.Multiline);
        else if (indentSize < 0)
            text = Regex.Replace(text, @"^" + new string(indentChar, Math.Abs(indentSize)), "", RegexOptions.Multiline);

        return text;
    }
}