项目作者: JuliaData

项目描述 :
fast parsing machinery for basic types in Julia
高级语言: Julia
项目地址: git://github.com/JuliaData/Parsers.jl.git
创建时间: 2018-06-14T13:36:26Z
项目社区:https://github.com/JuliaData/Parsers.jl

开源协议:MIT License

下载


Parsers.jl

CI
codecov
deps
version
pkgeval

A collection of type parsers and utilities for Julia.

Installation: at the Julia REPL, import Pkg; Pkg.add("Parsers")

Maintenance: Parsers is maintained collectively by the JuliaData collaborators.
Responsiveness to pull requests and issues can vary, depending on the availability of key collaborators.

Basic Usage

  1. using Parsers
  2. # basic int/float parsing
  3. x = Parsers.parse(Int, "101")
  4. y = Parsers.parse(Float64, "101.101")
  5. # use comma as decimal
  6. y2 = Parsers.parse(Float64, "101,101", Parsers.Options(decimal=','))
  7. # Bool parsing
  8. z = Parsers.parse(Bool, "true")
  9. # Date/DateTime parsing
  10. using Dates
  11. a = Parsers.parse(Date, "2018-01-01")
  12. # custom dateformat
  13. b = Parsers.parse(Date, "01/20/2018", Parsers.Options(dateformat="mm/dd/yyyy"))
  14. # will throw on invalid values
  15. Parsers.parse(Int, "abc")
  16. # tryparse will return `nothing` on invalid values
  17. y = Parsers.tryparse(Int, "abc")

Additional usage

Read through the docs of the following types/functions for more information on using advanced Parsers machinery:

  • ?Parsers.Options
  • ?Parsers.xparse
  • ?Parsers.Result
  • ?Parsers.ReturnCode