string_inflection
Version, currently 0.1.7.111 versions
- 0.2.1latestJul 23, 2017
- 0.2.0not indexedMay 12, 2021
- 0.1.7not indexedMay 12, 2021
- 0.1.7.1not indexedMay 12, 2021
- 0.1.6not indexedMay 12, 2021
- 0.1.5not indexedMay 12, 2021
- 0.1.4not indexedMay 12, 2021
- 0.1.3not indexedMay 12, 2021
- 0.1.2not indexedMay 12, 2021
- 0.1.1not indexedMay 12, 2021
- 0.1.0not indexedMay 12, 2021
github.com/mosop/string_inflection
Yet another Crystal library for string inflection.
9 stars
2 dependents
License: MIT
Nothing has been indexed for 0.1.7.1 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
string_inflection:
github: mosop/string_inflection
version: ~> 0.1.7.1Then run:
shards installshard.yml
No shard.yml has been indexed for 0.1.7.1. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
# Crystal String Inflection
Yet another Crystal library for string inflection.
[](https://travis-ci.org/mosop/string_inflection)
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
string_inflection:
github: mosop/string_inflection
```
## Usage
```crystal
require "string_inflection"
StringInflection.camel("foo bar") # => "fooBar"
StringInflection.pascal("foo bar") # => "FooBar"
StringInflection.snake("foo bar") # => "foo_bar"
StringInflection.kebab("foo bar") # => "foo-bar"
StringInflection.plural("child") # => "children"
StringInflection.singular("data") # => "datum"
```
Or do you like shorthand? So you can use the `Case` module.
```crystal
require "string_inflection/case"
Case.camel("foo bar") # => "fooBar"
Case.pascal("foo bar") # => "FooBar"
Case.snake("foo bar") # => "foo_bar"
Case.kebab("foo bar") # => "foo-bar"
Case.plural("child") # => "children"
Case.singular("data") # => "datum"
```
## Upper Case Replacement
With the `:up` option, `singular` / `plural` replaces a string with upper case letters.
```crystal
StringInflection.plural("CHILD", up: true) # => "CHILDREN"
StringInflection.singular("DATA", up: true) # => "DATUM"
```
Note: `:up` affects only a replaced substring.
```crystal
StringInflection.plural("child", up: true) # => "childREN"
StringInflection.singular("data", up: true) # => "datUM"
```
## String#to
The special extension `String#to` makes things object-oriented.
```crystal
require "string_inflection/string/to"
```
Then you can:
```crystal
"foo bar".to.camel # => "fooBar"
"foo bar".to.pascal # => "FooBar"
"foo bar".to.snake # => "foo_bar"
"foo bar".to.kebab # => "foo-bar"
"child".to.plural # => "children"
"data".to.singular # => "datum"
```
## Naming Methods
[WIP]
You can define inflection methods with your own names under your own namespaces.
## Special Thanks
### [Automatically Generated Inflection Database (AGID)](http://wordlist.aspell.net/agid-readme/)
The handy database by Kevin Atkinson and other authors is significantly useful to generate irregular singular/plural forms. You can see the license in [README](https://github.com/mosop/agid/blob/master/src/ext/agid/README).
## Releases
* v0.2.0
* (Breaking Change) StringInflection.define_inflector is separated into StringInflection.define_inflector and StringInflection.define_inflector_methods.
* v0.1.7
* Upper Case Replacement
* v0.1.3
* StringInflection.singular
* v0.1.2
* StringInflection.plural
* v0.1.1
* Case
* String#to
* StringInflection.define_inflector
## Development
[WIP]
## Contributing
1. Fork it ( https://github.com/mosop/string_inflection/fork )
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create a new Pull Request
## Contributors
- [mosop](https://github.com/mosop) - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.7.1- Tagged
- May 12, 2021
- Commit
a4b10756de7e- Indexed
- not yet
Dependents
Repository
github.com/mosop/string_inflection
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 11