Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Convert Text to Lower Case (dual mode)

Description
Converts text to lower case. Dual mode: works on selected text or clipboard text if nothing was selected.
Language
C#.net
Minimum Version
Created By
igorb
Contributors
-
Date Created
Aug 17, 2016
Date Last Modified
Aug 17, 2016

Macro Code

using System;

// Suggested HotKey: Alt + Ctrl + L
public static class ClipboardFusionHelper
{
	public static string ProcessText(string text)
	{
		// Setup.
		string clipboardText = text; // Get clipboard.

		string selectedText = string.Empty;
		BFS.Clipboard.CopyText(out selectedText); // Get selected text.

		if( string.IsNullOrWhiteSpace(selectedText))
		{
			text = clipboardText; // Operate on the clipboard text.
		}
		else
		{
			text = selectedText; // Operate on the selected text.
		}

		// End early if no text found.
		if(string.IsNullOrEmpty(text))
		{
			return null;
		}

		// Main.
		text = text.ToLower();

		// Wrapup.
		BFS.Clipboard.PasteText(text);
		return null;
	}
}