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

Add parser for MoneyFormatterBuilder.appendCurrencySymbolLocalized() #44

Open
TheLQ opened this issue May 16, 2014 · 2 comments
Open

Add parser for MoneyFormatterBuilder.appendCurrencySymbolLocalized() #44

TheLQ opened this issue May 16, 2014 · 2 comments
Labels

Comments

@TheLQ
Copy link

TheLQ commented May 16, 2014

Could a parser be added for MoneyFormatterBuilder.appendCurrencySymbolLocalized()? It would be useful when you get a "$12.34" string as input to pass it directly to joda-money, eg

MoneyFormatter format = new MoneyFormatterBuilder()
        .appendCurrencySymbolLocalized()
        .appendAmountLocalized()
        .toFormatter();
Money simpleMoney = format.parse(input)

On 0.9.1 this gives "java.lang.UnsupportedOperationException: MoneyFomatter has not been configured to be able to parse"

@jodastephen
Copy link
Member

Sounds entirely reasonable. I'm snowed under with work right now, but feel free to try a pull request.

@jens-meiss
Copy link

i have the same problem right now, can print a string with localized symbol, but can't use the formatter to parse this string ...

moneyFormatter = new MoneyFormatterBuilder()
                .appendAmountLocalized()
                .appendLiteral(" ")
                .appendCurrencySymbolLocalized()
                .toFormatter();

Money money = Money.of(CurrencyUnit.EUR, 12.35);

String moneyAsString = moneyFormatter.withLocale(locale).print(money);

moneyFormatter.parseMoney(moneyAsString);

last call throws this exception

java.lang.UnsupportedOperationException: MoneyFomatter has not been configured to be able to parse
JodaMoney 0.12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants