I want to convert C style LOGD("hello"); to LOGD<<"hello";
in eclipse find/replace.
how can I do that?
I want to convert C style LOGD("hello"); to LOGD<<"hello";
in eclipse find/replace.
how can I do that?
 
    
     
    
    You may try the following find and replace, in regex mode:
Find:
LOGD\("([^"]*)"\);
Replace:
LOGD << "$1";
We capture the text of the string input into LOGD in your code, and then use it as the RHS of the << operator in the replacement.  The (first) capture group is made available as $1.
 
    
    While a regexp may be Ok, I recommend to use a macro or better a template inline function rather than a regexp conversion:
#define LOGD(x) LOGD_CPP<<(x)
or
template<typename X> inline void LOGD(const X &x) {LOGD_CPP<<x;}
The reason is to be compliant with possible syntax complications inside x (nested parentheses, lambda-functions etc.)
 
    
    you can use in eclipse a regex based find/replace,
if you search by
LOG(.*?)\((.*?)\)
and replace to
LOG\1 << \2
this will find all levels in the log like debug, info warning error etc
LOGD("DEBUG:hello");
LOGW("WARNING:World"); 
LOGE("ERROR:Fooo"); 
LOGI("INFO:Fooo); 
and will replace it to
LOGD << "DEBUG:hello";
LOGW << "WARNING:World"; 
LOGE << "ERROR:Fooo"; 
LOGI << "INFO:Fooo; 
