[ 
https://issues.apache.org/jira/browse/JENA-967?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15228241#comment-15228241
 ] 

ASF GitHub Bot commented on JENA-967:
-------------------------------------

Github user afs commented on the pull request:

    https://github.com/apache/jena/pull/132#issuecomment-206374357
  
    For now, I think that "local locale" is the best single choice because if 
the user wants the XSD standard form "1.23" they can workaround it with a call 
`str()` and print a string. Not perfect but gives them a way.
    
    XSD F&O v3.1 has "picture strings" : 
https://www.w3.org/TR/xpath-functions-3/#dt-picture-string : that looks like 
Java DecimalFormat, not printf style.
    
    I think most people are familiar with printf and things like padding 
strings and alignment are covered. We can refine the capabilities after the 
machinery is in.


> 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
>            Priority: Minor
>
> 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)

Reply via email to