[gdal-dev] What is the best way to test if a CPLString is not empty?

Jorge Arévalo jorgearevalo at libregis.org
Thu May 16 11:54:40 PDT 2013


That sounds perfect. Thanks Frank!  

--  
Jorge Arevalo
Freelance developer

http://www.krop.com/jorgearevalo
http://about.me/jorgeas80

Enviado con Sparrow (http://www.sparrowmailapp.com/?sig)


El jueves 16 de mayo de 2013 a las 20:07, Frank Warmerdam escribió:

>  
>  
> Jorge,
>  
> I don't believe oString.c_str() will ever be NULL. You can use the std::string empty() method to test if a string is empty (zero length).  
>  
> http://www.cplusplus.com/reference/string/string/empty/
>  
> CPLStrings have no equivelient to a NULL distinct from being a zero length string.
>  
> Best regards,
> Frank
>  
> On Thu, May 16, 2013 at 10:17 AM, Jorge Arévalo <jorgearevalo at libregis.org (mailto:jorgearevalo at libregis.org)> wrote:
> > If I define a CPLString this way:
> >  
> > CPLString osString;
> >  
> > And I want to check if osString is not empty, what would be the best way?
> >  
> > My bet:
> >  
> > if (osString.c_str() == NULL)
> >  
> > But I find it a little rusty... Is there any other better way?
> >  
> > Many thanks in advance
> >  
> > --
> > Jorge Arevalo
> > Freelance developer
> >  
> > http://www.krop.com/jorgearevalo
> > http://about.me/jorgeas80
> >  
> > Enviado con Sparrow (http://www.sparrowmailapp.com/?sig)
> >  
> >  
> > _______________________________________________
> > gdal-dev mailing list
> > gdal-dev at lists.osgeo.org (mailto:gdal-dev at lists.osgeo.org)
> > http://lists.osgeo.org/mailman/listinfo/gdal-dev
>  
>  
>  
>  
> --  
> ---------------------------------------+--------------------------------------
> I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com (mailto:warmerdam at pobox.com)
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush | Geospatial Software Developer





More information about the gdal-dev mailing list