[OpendTect_Developers] Tool for searching a string

Nageswara Rao nageswara.rao at dgbes.com
Fri Feb 24 06:49:34 CET 2012


Hi all,
In this post I am explaining about  "GlobExpr class" (which is available 
under Basic/globexpr.h). This is very useful while searching for a 
string in another string (usually much longer than the search string). 
One can use the standard strstr function but this tool gives you the 
option of a case-insensitive search. You simply need to call the 
function 'matches()' which returns true if the match exists.

For example:
const char* expr = "searchstr";
GlobExpr* ge = new GlobExpr( expr, false );   //here searching the word 
with any case.
const bool ispresent = ge->matches( masterstring );

It is very simple!. Could you please let me know if you have any questions.

With regards,
Nageswara

--
G.V.Nageswara Rao
Software Developer
dGB Earth Sciences
304, Gateway plaza,Hiranandani gardens,Powai
Mumbai-400076, India
Phone: +91 22 25704984
nageswara.rao at dgbes.com, http://www.dgbes.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opendtect.org/pipermail/developers/attachments/20120224/68a6d318/attachment.html>


More information about the Developers mailing list