Wednesday, September 27, 2023

Visual Studio 2022 17.8.0 Preview 1.0: Case Preserving Find and Replace

In this post, let's have a look at some nice feature that got introduced with Visual Studio 2022 17.8.0 Preview 1.0. Right now the latest Visual Studio preview is, Visual Studio 2022 17.8.0 Preview 2.0, so as long as you have a Visual Studio version >= 17.8.0 Preview 1.0, you should be able to experience this feature.

In the Replace popups, either Quick Replace (Ctrl + H) or Replace in Files (Ctrl + Shift + H), you should be able to see an additional option "Preserve Case".

Quick Replace (Ctrl + H)
Replace in Files (Ctrl + Shift + H)
So what does this option do?

Consider the following.
// EmployeeId
// employeeId
// employeeid
// EMPLOYEEID
// employeeId
If you do a replace of employeeId with customerid while Preserving case, you can see all of the above is getting replaced to customerid, and it does so while preserving the case of the original word.  
// CustomerId
// customerId
// customerid
// CUSTOMERID
// customerId
Isn't that handy?

Hope this helps.

Happy Coding.

Regards,
Jaliya

No comments:

Post a Comment