Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlxStringUtil.formatMoney #1754

Closed
smks opened this issue Feb 29, 2016 · 4 comments
Closed

FlxStringUtil.formatMoney #1754

smks opened this issue Feb 29, 2016 · 4 comments

Comments

@smks
Copy link

smks commented Feb 29, 2016

  • Flixel version: 4.0.0

var price:Int = 60; // in pence
trace('£' + FlxStringUtil.formatMoney(this.price / 100));

// shows £.60;

package;

import flixel.FlxState;
import flixel.util.FlxStringUtil;

class PlayState extends FlxState
{
    override public function create():Void
    {
        var price:Int = 60; // in pence
                trace('£' + FlxStringUtil.formatMoney(this.price / 100));

                // shows £.60;
    }
}

Should show as £0.60

@Gama11 Gama11 changed the title FlxSpriteUtil.formatMoney FlxStringUtil.formatMoney Feb 29, 2016
@DleanJeans
Copy link
Contributor

Didn't even know this function exists. BTW could you add a String parameter named `Separator' or something? Since I want the "major quantites" separated by a space instead of dots or commas.

@Gama11
Copy link
Member

Gama11 commented Feb 29, 2016

Yeah, that EnglishStyle arugment seems unnecessarily inflexible.. I don't really want to replace it right now though, that would break backwards compatibility. For now you can just run StringTools.replace(str, ".", " ") on the result.

@DleanJeans
Copy link
Contributor

Whoops! I edited the comment and Slack didn't seem to update that.
What I meant was (keep EnglishStyle for the decimal point and) add a parameter for the separators/delimiters to group the digits.

@Gama11
Copy link
Member

Gama11 commented Feb 29, 2016

Then we'd have two arguments that do almost the same thing. Which argument would take precedence? Seems a bit messy.

@Gama11 Gama11 added the Bug label Mar 17, 2016
@Gama11 Gama11 closed this as completed in b7cabf0 Mar 17, 2016
Aurel300 pushed a commit to larsiusprime/haxeflixel that referenced this issue Apr 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants