From 04c85ccdf6f541b1de3c379c410e5cf07212433e Mon Sep 17 00:00:00 2001 From: ScottPJones Date: Wed, 6 Mar 2024 10:21:48 -0500 Subject: [PATCH] Update to use Format instead of Formatting --- Project.toml | 6 +++--- src/FWFTables.jl | 12 +++++------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Project.toml b/Project.toml index be1dd91..4eb3b7a 100644 --- a/Project.toml +++ b/Project.toml @@ -1,17 +1,17 @@ name = "FWFTables" uuid = "1acc1471-1fd5-4be2-a8c2-3f3b1db75813" authors = ["henrico "] -version = "0.1.0" +version = "0.1.1" [deps] FixedSizeStrings = "3ca710bb-85d4-534c-9bae-b7b5d9e27e20" -Formatting = "59287772-0a20-5a39-b81b-1366585eb4c0" +Format = "1fa38f19-a742-5d3f-a2b9-30dd87b9d5f8" Parsers = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" [compat] FixedSizeStrings = "0.1" -Formatting = "0.4" +Format = "1.3" Parsers = "1, 2" Tables = "1.0" julia = "1.5" diff --git a/src/FWFTables.jl b/src/FWFTables.jl index ea3bd28..95d25c1 100644 --- a/src/FWFTables.jl +++ b/src/FWFTables.jl @@ -2,7 +2,7 @@ module FWFTables import Tables import Parsers -import Formatting +import Format import FixedSizeStrings.FixedSizeString export readbla, Varspec, FWFTable, File, write @@ -292,15 +292,13 @@ end makewrite(::Type{FixedSizeString}, spec) = (io, val) -> Base.write(io, Ref(val)) function makewrite(::Type{Union{Missing, Int64}}, spec) - fs = "0>" * string(spec.length) * "d" - fe = Formatting.FormatSpec(fs) + fe = Format.FormatSpec(string("0>", spec.length, "d")) spaces = repeat(" ", spec.length) - return (io, val) -> ismissing(val) ? spaces : Formatting.printfmt(io, fe, val) + return (io, val) -> ismissing(val) ? spaces : Format.printfmt(io, fe, val) end function makewrite(::Type{Float64}, spec) - fs = "0>" * string(spec.length) * "." * string(spec.decimals) * "f" - fe = Formatting.FormatSpec(fs) - return (io, val) -> Formatting.printfmt(io, fe, val) + fe = Format.FormatSpec(string("0>", spec.length, ".", spec.decimals, "f")) + return (io, val) -> Format.printfmt(io, fe, val) end function makewrite(::Type{Nothing}, spec) spaces = repeat(" ", spec.length)