Author Topic: Advanced find and replace  (Read 127 times)

Offline Jewest

  • Multiple posting newcomer
  • *
  • Posts: 21
Advanced find and replace
« on: May 07, 2018, 11:16:08 am »
Hi,

I am using the vera++ checker and one of the remarks is that I use the short form for checking empty.
So far no problem, but I think the checker is right and I want to change the code.

so I want the change: if(!largertext.empty()) to: if(largertext.empty() == false)

any way to do this with the find and replace function?
If so how?

thank you in advance,

Jewest

Offline sodev

  • Almost regular
  • **
  • Posts: 141
Re: Advanced find and replace
« Reply #1 on: May 07, 2018, 01:07:39 pm »
Could be done with a regular expression, but i see no reason for. Actually the first form looks much more "correct" to me than the second one, especially in the c++ world where you use implicit conversions to bool the second one might even not work. Are you sure the checker complains about that? And are you sure that you are not using some strict c rules (i assume your code is c++)?

Offline BlueHazzard

  • Lives here!
  • ****
  • Posts: 1830
Re: Advanced find and replace
« Reply #2 on: May 09, 2018, 12:36:49 am »
Do you want to do this only for one variable name, or for a lot different variable names?