Skip to content

format() should accept SubString as well as String #84

Description

@bluesmoon

In format:

function format( x::T;
width::Int=-1,
precision::Int= -1,
leftjustified::Bool=false,
zeropadding::Bool=false, # when right-justified, use 0 instead of space to fill
commas::Bool=false,
signed::Bool=false, # +/- prefix
positivespace::Bool=false,
stripzeros::Bool=(precision== -1),
parens::Bool=false, # use (1.00) instead of -1.00. Used in finance
alternative::Bool=false, # usually for hex
mixedfraction::Bool=false,
mixedfractionsep::UTF8Str="_",
fractionsep::UTF8Str="/", # num / den
fractionwidth::Int = 0,
tryden::Int = 0, # if 2 or higher,
# try to use this denominator, without losing precision
suffix::UTF8Str="", # useful for units/%
autoscale::Symbol=:none, # :metric, :binary or :finance
conversion::ASCIIStr=""
) where {T<:Real}

several of the parameters are either UTF8Str or ASCIIStr, but this fails when the parameter passed in is a SubString{T}. This seemed to work with Formatting.jl

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