Home

Awesome

StrLiterals

contributions welcome

Julia VersionUnit TestsCoverage
Julia Latest

The StrLiterals package is an attempt to bring a cleaner string literal syntax to Julia, as well as having an easier way of producing formatted strings, borrowing from both Python and C formatted printing syntax. It also adds support for using LaTex, Emoji, HTML, or Unicode entity names that are looked up at compile-time. This builds on the previous work in StringUtils and StringLiterals, but is based on the new Strs.jl package

Currently, it adds a Swift style string macro, f"...", which uses the Swift syntax for interpolation, i.e. \(expression). This means that you never have to worry about strings with the $ character in them, which is rather frequent in some applications. Also, Unicode sequences are represented as in Swift, i.e. as \u{hexdigits}, where there can be from 1 to 6 hex digits. This syntax eliminates having to worry about always outputting 4 or 8 hex digits, to prevent problems with 0-9,A-F,a-f characters immediately following.

It also adds a string macro that instead of building a string, can print the strings and interpolated values directly, without having to create a string out of all the parts. Finally, there are uppercase versions of the macros, which also supports the legacy sequences, $ for string interpolation, \x followed by 1 or 2 hex digits, \u followed by 1 to 4 hex digits, and \U followed by 1 to 8 hex digits.

The StrFormat package adds type-based, C-style, and Python-style formatting, using the following escape characters (after \): % and {. See the package for more details.

The StrEntities package adds Emojis (starting with \: and ending with :), LaTeX entities (starting with \< and ending with >) similar to the Julia REPL, as well as HTML entities (starting with &, anding with ;), and Unicode entities (starting with \N{ and ending with } (similar to Python strings) See the package for more details.