StringUtils.jl
String utilities for Julia, Swift-like interpolation/quoting, better performing versions of string functions, etc.
Install / Use
/learn @ScottPJones/StringUtils.jlREADME
StringUtils
The StringUtils package in a work-in-progress, where I am placing various improvements on the String functionality in Julia language.
Currently, it adds a Swift style string macro, u"...", 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.
Finally, I have added four ways of representing characters in the literal string,
\:emojiname:, \<latexname>, \&htmlname; and \N{UnicodeName}.
This makes life a lot easier when you want to keep the text of a program in ASCII, and
also to be able to write programs using those characters that might not even display
correctly in their editor.
This now has some initial formatting capability, based on Tom Breloff's wonderful PR #10 to the JuliaIO/Formatting.jl package (by Dahua Lin and other contributors).
\%(arguments) is interpolated as a call to fmt(arguments).
This is especially useful when defaults have been set for the type of the first argument.
fmt_default!{T}(::Type{T}, syms::Symbol...; kwargs...) sets the defaults for a particular type.
fmt_default!(syms::Symbol...; kwargs...) sets the defaults for all types.
Symbols that can currently be used are: :ljust or :left, :rjust or :right, :commas,
:zpad or :zeropad, and :ipre or :prefix.
reset!{T}(::Type{T}) resets the defaults for a particular type.
defaultSpec(x) will return the defaults for the type of x, and
defaultSpec{T}(::Type{T}) will return the defaults for the given type.
This also adds support for \%ccc(arguments), where ccc is one or more characters of a
single C style format specification, which is interpolated as a call to cfmt("ccc", arguments).
I'm also experimenting with adding Python style syntax (as much as possible), as u"{pythonformat}"
Related Skills
node-connect
344.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
96.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
