h3 / jquery-utils

Automatically exported from code.google.com/p/jquery-utils
MIT License
0 stars 0 forks source link

String format does not escape braces correctly #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. $.format("My name is {0} :-{{}}", 'Fred')

What is the expected output?
My name is Fred :-{}

What do you see instead?
"My name is Fred :-{NaN}"

The quoted PEP says:

    Braces can be escaped by doubling:

        "My name is {0} :-{{}}".format('Fred')

    Which would produce:

        "My name is Fred :-{}"

Would be glad to see this issue getting fixed. Really, really helpful
plugin, though. Tanks a lot!

-- Pascal

Original issue reported on code.google.com by boyerc...@gmail.com on 2 Mar 2009 at 7:38

GoogleCodeExporter commented 9 years ago
Fixed that for ya, added new unit tests too. Thanks a lot for reporting ;)

Original comment by hainea...@gmail.com on 8 Mar 2009 at 4:01

GoogleCodeExporter commented 9 years ago
Thanks a lot! This will make my code a lot cleaner. (:

Original comment by boyerc...@gmail.com on 8 Mar 2009 at 4:02