[QGIS-Developer] substr expression 1-based? Others too?
madmanwoo at gmail.com
Mon May 8 06:39:50 PDT 2017
Postgres, SQL Server, etc are all 1 based. Hence the alignment with that
On Mon, May 8, 2017 at 11:31 PM, Richard Duivenvoorde <rdmailings at duif.net>
> Hi Devs,
> Trying to create a rule based style I encountered/used the 'substr'
> function to find the first character of a field.
> Isn't it strange that this function is one based while in all languages
> I know this kind of function(s) are zero-based?
> now it is:
> substr('Hello',0,1) returns ''
> while I expected it to return 'H'
> substr('Hello',1,1) returns 'H'
> in QGIS3 there is also:
> substr('Hello',-1,1) returns 'o' # ok
> Are more functions one-based instead of (the normal?) zero-based?
> Is it an idea to bring the expression(s) inline with other programming
> Or is there a special reasoning not to do this?
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the QGIS-Developer