Handy string conversions
- Swift 5.5+
- Xcode 13.0+
- macOS 11.0+
A Mac OS command line tool to perform some handy string conversions
OVERVIEW: Handy string conversions
USAGE: stringy <subcommand>
OPTIONS:
-h, --help Show help information.
SUBCOMMANDS:
camelcase Converts strings to camelCase
snakecase Converts strings to snake_case.
kebabcase Converts strings to kebab-case.
See 'stringy help <subcommand>' for detailed help.
OVERVIEW: Converts strings to camelCase
E.G. Earth Sun Moon -> earthSunMoon
USAGE: stringy camelcase [--invert] [<strings> ...]
ARGUMENTS:
<strings>
OPTIONS:
-i, --invert Inverts the conversion.
-h, --help Show help information.
OVERVIEW: Converts strings to snake_case.
E.G. 'Snakes are slithery' -> 'snakes_are_slithery'
USAGE: stringy snakecase [--invert] [<strings> ...]
ARGUMENTS:
<strings>
OPTIONS:
-i, --invert Inverts the conversion.
-h, --help Show help information.
OVERVIEW: Converts strings to kebab-case.
E.G. 'Words on a stick' -> 'words-on-a-stick'
USAGE: stringy kebabcase [--invert] [<strings> ...]
ARGUMENTS:
<strings>
OPTIONS:
-i, --invert Inverts the conversion.
-h, --help Show help information.
With Mint
$ mint install salishseasoftware/stringy
Clone the repo then:
$ make install
Or using swift itself:
$ swift build -c release
$ cp .build/release/stringy /usr/local/bin/stringy
Generate the Xcode project:
$ swift package generate-xcodeproj
$ open ./Stringy.xcodeproj
In Xcode:
- Product > Archive
- Distribute Content
- Built Products
- copy the
stringy
executable to/usr/local/bin/
, or wherever you prefer.
A package of handy String
and StringProtocol
extensions.
Some general utility String extensions.
Makes use of NSDataDetector
to parse known data types from a string.
Extends String to conform to the Error
protocol.
This allows throwing a simple string. E.G. throw "Foo"
.
Some general utility StringProtocol extensions.
Some handy conversions.
For example:
camelcased()
snakecased()
kebabcased()