Skip to content

Custom format to String #86

Description

@junder873

If I want to create a string from a custom format, it seems like I am supposed to use cfmt or format, but these do not have complete flexibility.

For example, if I want to create a string for $\pi$ surrounded by parentheses ((3.14)), how would I do that? printfmtln will display it: printfmtln("({:0.2f})", π), but this returns nothing (so it cannot be used later in the program). I tried cfmt but cfmt("(%0.2f)", π) causes an error. It is possible through format by running format(-π; parens=true) but this is not always work if I want something else besides parentheses.

With Printf, this is possible: Printf.format(Printf.Format("(%0.2f)"), π) will return a string. So can cfmt be extended to accept similar options?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions