[Qgis-developer] BUG? strpos("area",'.') doesn't work

Mathieu Pellerin nirvn.asia at gmail.com
Mon Nov 7 04:10:23 PST 2016


You read my mind. Big +1 from me.

On Nov 7, 2016 6:40 PM, "Matthias Kuhn" <matthias at opengis.ch> wrote:

> I wonder if we should change this for QGIS 3.0 and use QString::indexOf
> instead, while providing dedicated regexp functions.
>
> What do you think, Mathieu?
>
> Matthias
>
> On 11/07/2016 12:26 PM, Mathieu Pellerin wrote:
> > We should indicate in the function help that strpos is regexp based.
> >
> >
> > On Nov 7, 2016 6:23 PM, "Matthias Kuhn" <matthias at opengis.ch
> > <mailto:matthias at opengis.ch>> wrote:
> >
> >     Hi,
> >
> >     strpos is based on regexp, a '.' matches any character.
> >     To let the engine treat a . as such you need to prefix it with a
> >     double-backslash.
> >
> >     strpos(to_string("area"), '\\.')
> >
> >     Regards
> >     Matthias
> >
> >
> >     On 11/07/2016 12:07 PM, Elstermann, Mike wrote:
> >     > Hi,
> >     >
> >     >
> >     >
> >     > “area” is a double-field with values e. g. 213.1234,  43215.3456, …
> >     >
> >     >
> >     >
> >     > strpos("area",'.') gives only value 1 return :-(
> >     >
> >     > strpos(to_string("area"),'.') gives only value 1 return  :-(
> >     >
> >     >
> >     >
> >     > This error exits only by ‘.’, other search-strings e. g. ‘12’,
> ‘1’, …
> >     > work fine
> >     >
> >     >
> >     >
> >     > Our workarround works fine.
> >     >
> >     >
> >     >
> >     > strpos( replace( to_string( "area" ), '.', ',' ), ',' )
> >     >
> >     >
> >     >
> >     > Is this a bug with ‘.’?
> >     >
> >     >
> >     >
> >     > best regards, mikeE.
> >     >
> >     >
> >     >
> >     >
> >     >
> >     >
> >     >
> >     > _______________________________________________
> >     > Qgis-developer mailing list
> >     > Qgis-developer at lists.osgeo.org <mailto:Qgis-developer at lists.
> osgeo.org>
> >     > List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
> >     <http://lists.osgeo.org/mailman/listinfo/qgis-developer>
> >     > Unsubscribe:
> >     http://lists.osgeo.org/mailman/listinfo/qgis-developer
> >     <http://lists.osgeo.org/mailman/listinfo/qgis-developer>
> >     >
> >     _______________________________________________
> >     Qgis-developer mailing list
> >     Qgis-developer at lists.osgeo.org <mailto:Qgis-developer at lists.
> osgeo.org>
> >     List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
> >     <http://lists.osgeo.org/mailman/listinfo/qgis-developer>
> >     Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
> >     <http://lists.osgeo.org/mailman/listinfo/qgis-developer>
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20161107/ae246fbf/attachment.html>


More information about the Qgis-developer mailing list