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

Android Contacts – Clear/Remove Notes

Posted on December 11, 2013October 26, 2015

SELECT data1 FROM data INNER JOIN mimetype ON mimetype_id = mimetypes._id WHERE mimetype LIKE "%note%" AND length(data1) > 0 UPDATE data SET data1 = NULL FROM data INNER JOIN mimetype ON mimetype_id = mimetypes._id WHERE mimetype LIKE "%note%" Originally Posted on December 11, 2013Last Updated on October 26, 2015 All…

Read More

PowerShell – Recycle All App Pools

Posted on January 24, 2020

Write-Host "App Pool Recycling Started…." -ForegroundColor Green & $env:windir\system32\inetsrv\appcmd list apppools /state:Started /xml | & $env:windir\system32\inetsrv\appcmd recycle apppools /in Write-Host "App Pool Recycling Completed" -ForegroundColor Green 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)…

Read More

Red Hat / CentOS / Fedora – Create Jailed SFTP User

Posted on December 26, 2017

If you are working on a project and need SFTP capabilities but don’t want users to see each other’s files create a SFTP Jailed server. Assumptions for the code below is that you are running Red Hat, CentOS, or Fedora and already have the OS running. NOTE: In this first…

Read More

Code

Top Posts & Pages

  • Front Page
  • SQLite - Auto-Increment / Auto Generate GUID
  • PowerShell - Change Windows CD/DVD Drive Letter
  • PowerShell - UNIX SED Equivalent - Change Text In File
  • PowerShell - Java JDK/JRE Unattended Install

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

  • SQLite - Auto-Increment / Auto Generate GUID
  • PowerShell - Change Windows CD/DVD Drive Letter
  • PowerShell - UNIX SED Equivalent - Change Text In File
  • PowerShell - Java JDK/JRE Unattended Install
  • PowerShell - Show File Extensions
  • Raspberry Pi - Dynamic MOTD
©2025 David Kittell | WordPress Theme by SuperbThemes
 

Loading Comments...
 

You must be logged in to post a comment.