I'm trying to remove the lower case letters on a TextBox
..
For example, short alpha code representing the insurance (e.g., 'BCBS' for 'Blue Cross Blue Shield'):
txtDesc.text = "Blue Cross Blue Shield";
string Code = //This must be BCBS..
Is it possible? Please help me. Thanks!
To use a keyboard shortcut to change between lowercase, UPPERCASE, and Capitalize Each Word, select the text and press SHIFT + F3 until the case you want is applied.
Create regular expressions to remove uppercase, lowercase, special, numeric, and non-numeric characters from the string as mentioned below: regexToRemoveUpperCaseCharacters = “[A-Z]” regexToRemoveLowerCaseCharacters = “[a-z]” regexToRemoveSpecialCharacters = “[^A-Za-z0-9]”
In Python, lower() is a built-in method used for string handling. The lower() method returns the lowercased string from the given string. It converts all uppercase characters to lowercase. If no uppercase characters exist, it returns the original string.
Alternatively known as caps and capital, and sometimes abbreviated as UC, uppercase is a typeface of larger characters. For example, typing a, b, and c shows lowercase, and typing A, B, and C shows uppercase. To type in uppercase, you can use either the Caps Lock key or the Shift key on the keyboard.
Well you could use a regular expression to remove everything that wasn't capital A-Z:
using System;
using System.Text.RegularExpressions;
class Program
{
static void Main( string[] args )
{
string input = "Blue Cross Blue Shield 12356";
Regex regex = new Regex("[^A-Z]");
string output = regex.Replace(input, "");
Console.WriteLine(output);
}
}
Note that this would also remove any non-ASCII characters. An alternative regex would be:
Regex regex = new Regex(@"[^\p{Lu}]");
... I believe that should cover upper-case letters of all cultures.
string Code = new String(txtDesc.text.Where(c => IsUpper(c)).ToArray());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With