Possibility of standardized sprintf() in ES4?

Dan Scott denials at gmail.com
Mon Oct 15 17:15:12 PDT 2007


On 15/10/2007, ekameleon <ekameleon at gmail.com> wrote:
>
> Hello :)
>
> Yes i prefere too the Strings.format implementation :)  For me it's an
> important feature and can be insert in the core String methods :)
>
> EKA+ :)
>
> 2007/10/15, zwetan <zwetan at gmail.com>:
> >
> > Hi,
> >
> > ...
> > >
> > > Is there any other interest in adding a native sprintf() (probably as
> > > String.sprintf()) to the ES4 specs?
> > >
> >
> > I'm interested in string formating, but surely not sprintf
> > I don't find it intuitive at all
> >
> > I prefer something closer to String.format from .NET
> > but more dynamic and being able to use sort of tokens
> > like the ones you can use with E4X (<node>{token}</node>)
> >
> > see here for an implementation
> > http://maashaack.googlecode.com/svn/trunk/ES4a/src/system/Strings.as
> > ( public static function format( format:String, ...args ):String )
> >
> > cheers,
> > zwetan
> > _______________________________________________
> > Es4-discuss mailing list
> > Es4-discuss at mozilla.org
> > https://mail.mozilla.org/listinfo/es4-discuss
> >
>
>
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es4-discuss
>
>
Sure. From what I can see of the Microsoft documentation a standardized
String.format() function would meet the need for a standardized way of
formatting a string just as well as a method based on C/Perl/PHP/Ruby
sprintf() and Python's native string formatting, where named parameters are
used instead of positional parameters.

Assuming there are no intellectual property concerns with adopting
Microsoft's specification for this method, it would satisfy my use case for
a string formatting method that accepts explicit positional or named
parameters in support of internationalized text. I would simply be delighted
if ES4 saved me and others from having to roll our own string formatter
classes!

-- 
Dan Scott
Laurentian University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.mozilla.org/pipermail/es-discuss/attachments/20071015/4fb984e1/attachment-0002.html 


More information about the Es4-discuss mailing list