Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

Change Text Case

Posted on February 22, 2013February 8, 2016 By David Kittell

ChangeTextCase

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Threading;

namespace ChangeTextCase
{
	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
		}

		private void btnCopy_Click(object sender, EventArgs e)
		{
			txtDestination.SelectAll();
			txtDestination.Copy();
		}

		private void btnChangeCase_Click(object sender, EventArgs e)
		{
			string sText = txtSource.Text;
			txtSource.Text = "";
			txtDestination.Text = "";

			#region Get the culture property of the thread.
			CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
			//Create TextInfo object.
			TextInfo textInfo = cultureInfo.TextInfo;
			#endregion Get the culture property of the thread.

			#region Title case
			if (rbTitleCase.Checked == true)
			{
				sText = sText.ToLower();
				txtDestination.Text = textInfo.ToTitleCase(sText);
			}
			#endregion Title case

			#region Lower case
			if (rbLowerCase.Checked == true)
			{
				txtDestination.Text = sText.ToLower();
			}
			#endregion Lower case

			#region Upper case
			if (rbUpperCase.Checked == true)
			{
				txtDestination.Text = sText.ToUpper();
			}
			#endregion Upper case


			#region Remove Line Break - Start
			if (rbRemoveLineBreak.Checked == true)
			{
				if (ckRemoveTabs.Checked == false)
				{
					//txtDestination.Text = sText.Replace(System.Environment.NewLine, sText);
					string replaceWith = "";
					txtDestination.Text = sText.Replace("rn", replaceWith).Replace("n", replaceWith).Replace("r", replaceWith);
				}
				else
				{
					//txtDestination.Text = sText.Replace(System.Environment.NewLine, sText);
					string replaceWith = "";
					txtDestination.Text = sText.Replace("rn", replaceWith).Replace("n", replaceWith).Replace("r", replaceWith).Replace("t", replaceWith).Replace(" '", "'");
				}
			}
			#endregion  Remove Line Break - Stop
		}
	}
}
Originally Posted on February 22, 2013
Last Updated on February 8, 2016
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

C# Project Code CSharp

Post navigation

Previous post
Next post

Related Posts

PHP – File Download

Posted on March 16, 2016

When WGET isn’t available PHP comes to the rescue. In this example $path file name can be different than the $url file name or the same, if it is different it will be saved with the file name in $path set_time_limit(0); //Unlimited max execution time $path = ‘filetodownload.txt’; $url =…

Read More

Strong Password

Posted on May 15, 2017

Need help with what a strong password is? Strong password recommendations are as follows: Must contain 14 or more characters Must contain upper and lower case letters Must contain a number or special character (e.g. !@#$%^) Must NOT be the same as your previous 12 passwords Must NOT be similar…

Read More

Mac OSX Terminal – Get Mac Internal/External IP

Posted on June 17, 2016June 7, 2019

#!/bin/bash clear # Get IP – Start ip=$(ipconfig getifaddr en0) nen=0 while [ -z $ip ]; do let nen=nen+1 eth="en$nen" #echo $eth ip=$(ipconfig getifaddr $(echo $eth)) done echo "Internal IP: " $ip # Get IP – Stop #Variables – stop #echo "External IP: " $(curl -s https://www.kittell.net/ip.php) echo "External IP:…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • Open On Screen Keyboard (OSK)
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes
 

Loading Comments...
 

You must be logged in to post a comment.