Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Can the toString() function format numbers according to their type? #575

Closed
jphillips-bp3 opened this issue Mar 14, 2019 · 3 comments
Closed

Comments

@jphillips-bp3
Copy link

I am using the toString function to turn a Long type into a String. For example when I call toString(myDate.getYear()) it returns 2019.0 instead of just 2019. I have tried this on an Integer and get a decimal place tacked onto the end of it as well.

Would it be possible for toString to be type aware and format numerical types appropriately?

@jeromesimeon
Copy link
Member

That's a good request, and even could be considered a bug.

@jeromesimeon jeromesimeon added Type: Bug 🐛 Something isn't working Type: Feature Request 🛍️ New feature or request labels Mar 14, 2019
@jeromesimeon
Copy link
Member

A fix for this is being worked on in the "Dynamic Templates" branch https://github.com/accordproject/ergo/tree/js-feature-dynamic-templates

This fix relies on the ability to distinguish between Integer and Double in the JavaScript runtime.

@jeromesimeon jeromesimeon moved this from In progress to Issue (Priority: Medium) in Rich Text and Dynamic Templates Jul 20, 2019
@jeromesimeon jeromesimeon moved this from Issue (Priority: Medium) to Issue (Priority: High) in Rich Text and Dynamic Templates Jul 20, 2019
@jeromesimeon jeromesimeon added this to Open Issues in Ergo + Cicero v0.20 Sep 27, 2019
@jeromesimeon jeromesimeon moved this from Open Issues to In Progress Issues in Ergo + Cicero v0.20 Oct 14, 2019
@jeromesimeon
Copy link
Member

Fixed in the 0.20 branch. Test here in the REPL:

Screenshot 2019-10-14 at 3 19 25 PM

Rich Text and Dynamic Templates automation moved this from Issue (Priority: High) to Finished (Issue) Oct 14, 2019
Ergo + Cicero v0.20 automation moved this from In Progress Issues to Finished Issues Oct 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
0.20 Type: Bug 🐛 Something isn't working Type: Feature Request 🛍️ New feature or request
Projects
No open projects
Ergo + Cicero v0.20
  
Finished Issues
Rich Text and Dynamic Templates
  
Finished (Issue)
Development

No branches or pull requests

2 participants