[
https://issues.apache.org/jira/browse/JENA-967?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andy Seaborne resolved JENA-967.
--------------------------------
Resolution: Done
Assignee: Andy Seaborne
Fix Version/s: Jena 3.1.0
Contribution from GitHub user ales004 - thanks!
> Suggested ARQ Extension function: afn:printf(...)
> -------------------------------------------------
>
> Key: JENA-967
> URL: https://issues.apache.org/jira/browse/JENA-967
> Project: Apache Jena
> Issue Type: New Feature
> Components: ARQ
> Reporter: Stuart Williams
> Assignee: Andy Seaborne
> Priority: Minor
> Fix For: Jena 3.1.0
>
>
> There are situations where it would be useful to be able to format strings
> bound to variable. In particular I have wanted to create some zero-filled
> numeric strings.
> I've accomplished the task with a pair of BINDs as follows where {{?code}} is
> bound to a numeric string:
> {noformat}
> BIND( "000000" as ?zfill )
> BIND(
> concat(if(strlen(?code)>=strlen(?zfill),"",substr(?zfill,strlen(?code)+1)),?code)
> as ?reg_notation)
> {noformat}
> But it would have been nice to be able to use something less opaque like:
> {noformat}
> BIND( afn:printf("%06d",?code) as ?reg_notation)
> {noformat}
> So 'improvement'/'new feature' suggestion is an additional ARQ Extension
> function that exposes java {{printf}} method.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)