Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hsugawa8651/simplestringscanners.jl

Julia package for lexical scanning operations on a string
https://github.com/hsugawa8651/simplestringscanners.jl

julia julia-language julialang parsing string

Last synced: about 1 month ago
JSON representation

Julia package for lexical scanning operations on a string

Awesome Lists containing this project

README

        

# SimpleStringScanners

[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://hsugawa8651.github.io/SimpleStringScanners.jl/stable/)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://hsugawa8651.github.io/SimpleStringScanners.jl/dev/)
[![Build Status](https://github.com/hsugawa8651/SimpleStringScanners.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/hsugawa8651/SimpleStringScanners.jl/actions/workflows/CI.yml?query=branch%3Amain)

Helper for scanning fixed-length substring and parsing.

# Quick start

```julia
julia> using SimpleStringScanners

julia> scanner=SimpleStringScanner(" 2 3d-1");

julia> advance!(scanner,3)
" 2"

julia> advance!(scanner,5)
" 3d-1"
```

```julia
julia> using SimpleStringScanners

julia> scanner=SimpleStringScanner(" 2 3d-1");

julia> tryparse1Int64(scanner,3)
2

julia> tryparse1Float64(scanner,5)
0.3
```

```julia
julia> using SimpleStringScanners

julia> scanner=SimpleStringScanner(" 12 34");

julia> tryparse1Int64(scanner, r"\d+")
12

julia> tryparse1Int64(scanner, r"\d+")
34
```