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'
but:
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
languages?

Or is there a special reasoning not to do this?

Regards,

Richard

_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to