Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to replace to uppercase in Visual Studio?

Is it possible to replace to upper case in Visual Studio using "Find and Replace" dialog and RegEx (?) à la: . => Upper(.)?

Say I have:

m_<b>a</b>blabla 

I want:

_<b>A</b>blabla 
like image 344
serhio Avatar asked Apr 30 '10 10:04

serhio


People also ask

How do I make uppercase code in Visual Studio?

Highlight the text you want to uppercase. Then hit CTRL + SHIFT + P to bring up the command palette. Then start typing the word "uppercase", and you'll see the Transform to Uppercase command.

How do you change case in VS code?

Command Palette: CTRL + SHIFT + p (Mac: CMD + SHIFT + p ) type >transform pick upper/lower case and press enter.

How do I change everything to CAPS?

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.

Is there a command to make all letters lowercase?

Hold down the Shift and press F3 . When you hold Shift and press F3, the text toggles from sentence case (first letter uppercase and the rest lowercase), to all uppercase (all capital letters), and then all lowercase.


1 Answers

You can solve this by using Visual Studio temporary macros. This is a very powerful, flexible feature which I use all the time for performing repetitive code manipulations.

I'm assuming you're using the C# default key bindings here.

  1. Press CTRL+SHIFT+F to bring up the find in files dialogue.
  2. Click use "Regular expressions"
  3. Set "Find what:" to "<m_:Ll" - words that begin with m, underscore, then a lower case letter;
  4. Click "Find all" to search for all occurrences;
  5. Press CTRL+SHIFT+R to start recording temporary macro;
  6. Press F8 to find next occurrence of search expression;
  7. Press right cursor, right cursor, SHIFT + right cursor (to skip "m_" and then select the lower case letter);
  8. Press CTRL+SHIFT+U to uppercase the lower case letter;
  9. Press CTRL+SHIFT+R to stop recording temporary macro;
  10. Press CTRL+SHIFT+P to replay temporary macro, which will jump to next expression and uppercase the first letter after the "m_". You need to press CTRL+SHIFT+P as many times as there are expressions.
like image 192
RickL Avatar answered Sep 23 '22 03:09

RickL