W3C home > Mailing lists > Public > public-sparql-dev@w3.org > April to June 2014

SUBSTR with negativ length

From: Jürgen Jakobitsch <j.jakobitsch@semantic-web.at>
Date: Tue, 29 Apr 2014 16:11:56 +0200
Message-ID: <CAETaefwyVMgQ=j3JKDLTeyFPcnMb-rd1RFf=4WwpWpJ7fH1J2g@mail.gmail.com>
To: public-sparql-dev@w3.org
hi,

i just have checked a couple of implementations regarding the behaviour of
negative length for SUBSTR sparql function. what i tried to achieve is to
get
the last two characters of a string, but this doesn't really work anywhere.

a use case : number padding

example :

SELECT ?padded WHERE {
  ?s ?p ?num FILTER(isNumeric(?num) && ?num<10000000) .
  BIND(SUBSTR(CONCAT("0000000", ?num),STRLEN(?num),-7) AS ?padded)
}

any thoughts?

wkr jürgen


| Jürgen Jakobitsch,
| Software Developer
| Semantic Web Company GmbH
| Mariahilfer Straße 70 / Neubaugasse 1, Top 8
| A - 1070 Wien, Austria
| Mob +43 676 62 12 710 | Fax +43.1.402 12 35 - 22

COMPANY INFORMATION
| web       : http://www.semantic-web.at/
| foaf      : http://company.semantic-web.at/person/juergen_jakobitsch
PERSONAL INFORMATION
| web       : http://www.turnguard.com
| foaf      : http://www.turnguard.com/turnguard
| g+        : https://plus.google.com/111233759991616358206/posts
| skype     : jakobitsch-punkt
| xmlns:tg  = "http://www.turnguard.com/turnguard#"
Received on Tuesday, 29 April 2014 14:12:23 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:15:52 UTC