Giter Club home page Giter Club logo

printf-as3's People

Contributors

davyzhang avatar gabriel-laet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

printf-as3's Issues

4 - SUBS_RE is buggy

What steps will reproduce the problem?
1. printf("%.2f", 0.0)

What is the expected output? What do you see instead?
2. returns %.2f
3. instead of 0.00

What version of the product are you using? On what operating system?
last

Please provide any additional information below.
SUBS_RE seems wrong.
i changed it to this instead:
var SUBS_RE : RegExp = /%(?!^%)(((?P<var_name>[\w_\d]+)))?(?P<padding>[0-9]{1,2})?(.(?
P<precision>[0-9]+))?(?P<formater>[sxofaAbBcdHIjmMpSUwWxXyYZ])/ig;

note how the precision part is moved AFTER the padding and BEFORE the formater
(as it should)

this doesn't enforce .00 though (in case of %.2f when supplied integer arguments)


Original link: http://code.google.com/p/printf-as3/issues/detail?id=4

2 - Leading Zeros

There ist no support for leading zeros.

Means:
..("%03d", 6); -> "006"

Please add this feature!

Original link: http://code.google.com/p/printf-as3/issues/detail?id=2

5 - %.3f doesnt actually work

use rev19 of the code

use the codeL 

trace( printf("You can also display numbers like PI: %f, and format them to
a fixed precision, such as PI with 3 decimal places %.3f", Math.PI, Math.PI));

produces 

You can also display numbers like PI: 3.141592653589793, and format them to
a fixed precision, such as PI with 3 decimal places %.3f

it should display 3.141 not %.3f


Original link: http://code.google.com/p/printf-as3/issues/detail?id=5

7 - package structure removed

I'm not sure why, but you've removed the perfectly sensible package
structure for this as3 code.

It's a real shame because as I use libraries like this using svn external
properties, however having code like this dumped in the base package is
messy and could cause conflicts with other packages/libraries.

Would you please consider re-adding the package structure, it also helps
identify the project and reveal code dependencies.

While I'm writing this, I should thank you for a good idea well implemented.

Original link: http://code.google.com/p/printf-as3/issues/detail?id=7

Rounding

Commit: b74c6a1

when some one does:

printf("%.2f", 0.0000000007)

It becomes: 0.1 ??

3 - Formatting a numeric value with a fixed number of decimal places doesn't work

What steps will reproduce the problem?
1. import the printf
2. execute the code v = printf("%.2f", v), with v an untyped variable 
originally containing a floating point number (eg, 0.4858329, 5.094833)
3. look at v

What is the expected output? What do you see instead?
v should contain a string with the numeric value to two DP (eg, "0.486", 
"5.095" for the example values).

In fact, it simply repeats the formatting string (eg, "%.2f" for all values 
of v).

Removing the ".2" qualification, leaving a format string of "%f", produces 
the expected result.

What version of the product are you using? On what operating system?
The ZIP file describes itself as "rev6". Running Adobe Flash CS3 and Flash 
Player 9 on Windows XP SP3.

Please provide any additional information below.


Original link: http://code.google.com/p/printf-as3/issues/detail?id=3

padding is not right

printf("this is %03d%s",1,'A')

output
this is 0001A

should be
this is 001A

I checked your function
/** @Private */
function padString(str:String, paddingNum:int, paddingChar:String=" ") : String
{
if(paddingChar == null) return str;

return new Array(paddingNum + 1).join(paddingChar).concat(str);

}

it's not right for padding, array,joined the padding char at first And append the str at last

should be like this one

/** @Private */
function padString(str:String, paddingNum:int, paddingChar:String=" ") : String
{
if(paddingChar == null) return str;

return new Array(paddingNum + 1).join(paddingChar).substr(0,paddingNum-str.length).concat(str);

}

9 - Enhancement proposal: support for nested object properties and array indexing

Attached is a proposal of extension to printf function with the following features:
1. Nested property references are supported, i.e. %(user.account.login)s
2. Special support for array indexing of nested properties is implemented as well, for example:
%(user.roles.item4.name)s // roles.item4 is in fact roles[4], hence the name of fifth role (zero based) of array-like\* property "roles" is printed
%(user.roles.first.name)s // name of first role, syntactic sugar
%(call.arguments.last)s // last argument of array-like property "arguments" syntactic sugar

*"Array-like" means that object must support "length" property and allows indexed access to items; examples are Array, ArrayCollection and similar.

Regrds,
Valery Silaev
Farata Systems
http://flexblog.faratasystems.com/


Original link: http://code.google.com/p/printf-as3/issues/detail?id=9

1 - Error when using only one substituted string (%s)

What steps will reproduce the problem?
1. Alert.show(printf("This is an %s library", "Actionscript 3.0"));

What is the expected output? What do you see instead?

Expected an alert with the message "This is an Actionscript 3.0 library". Instead I get this error:

ReferenceError: Error #1069: Property  not found on String and there is no default value.
    at 
global/br.com.stimuli.string::printf()[/Users/daniel/laplace/reg_web/app/flex/br/com/stimuli/string/p
rintf.as:74]

What version of the product are you using? On what operating system?

Revision 1. Mac OS X 10.5.

Please provide any additional information below.

I'm using Flex Builder 3.0.194161.

If I add a third parameter to printf it works.

Alert.show(printf("This is an %s library", "Actionscript 3.0", "")); // works
Alert.show(printf("This is an %s library", "Actionscript 3.0")); // doesn't work


Original link: http://code.google.com/p/printf-as3/issues/detail?id=1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.