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?

Convert Readable Text to Camel Case

Description
This macro will convert the text on the clipboard to camel case.
Language
C#.net
Minimum Version
Created By
Gabriel A.A13644
Contributors
-
Date Created
Oct 25, 2023
Date Last Modified
Oct 25, 2023

Macro Code

using System;
using System.Text.RegularExpressions;

public static class ClipboardFusionHelper
{
	public static string ProcessText(string text)
	{
		// Elimina los espacios adicionales y divide la cadena en palabras
		string[] words = text.Trim().Split(' ');

		// Convierte la primera palabra a minúsculas
		words[0] = words[0].ToLower();

		// Convierte las palabras restantes a PascalCase (la primera letra en mayúsculas)
		for (int i = 1; i < words.Length; i++)
		{
			if (!string.IsNullOrEmpty(words[i]))
			{
				words[i] = char .ToUpper(words[i][0]) + words[i].Substring(1).ToLower();
			}
		}

		// Une todas las palabras sin espacios para obtener la cadena en camelCase
		return string.Concat(words);
	}
}