Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

StrFormat

contributions welcome

Julia Version Unit Tests Coverage
Julia Latest

The following extra format sequences (see StrLiterals for the full specification) are added:

  • \%<ccc><formatcode>(arguments) is interpolated as a call to cfmt("<cccc><formatcode>",arguments), where <ccc><formatcode> is a C-style format string.

  • \%(arguments) is interpolated as a call to fmt(arguments). This is especially useful when defaults have been set for the type of the first argument.

  • fmt_default!{T}(::Type{T}, syms::Symbol...; kwargs...) sets the defaults for a particular type.

  • fmt_default!(syms::Symbol...; kwargs...) sets the defaults for all types.

Symbols that can currently be used are: :ljust or :left, :rjust or :right, :commas, :zpad or :zeropad, and :ipre or :prefix.

  • reset!{T}(::Type{T}) resets the defaults for a particular type.
  • defaultSpec(x) will return the defaults for the type of x, and
  • defaultSpec{T}(::Type{T}) will return the defaults for the given type.

There is currently support for Python style formatting, although that is a work-in-progress, and I am intending to improve the syntax to make it as close as possible to Python's 3.6 format strings. Currently, the syntax is \{<formatstring>}(expression), however I plan on changing it shortly to \{expression} (equivalent to pyfmt("", expression), and \{expression;formatstring} (equivalent to pyfmt("formatstring", expression).

About

Extends StrLiterals.jl with formatting capabilities

Topics

Resources

License

Languages

You can’t perform that action at this time.