Library for D to support inflection based string transformations
Find a file
2023-10-03 06:41:03 +02:00
source/inflect Add comments 2023-10-03 06:41:03 +02:00
.gitignore Initial commit 2023-10-03 06:36:53 +02:00
dub.json Initial commit 2023-10-03 06:36:53 +02:00
LICENSE Initial commit 2023-10-03 06:36:53 +02:00
readme.md Initial commit 2023-10-03 06:36:53 +02:00

inflect

A inflection library for D projects.

License

The code in this repository is licensed under AGPL-3.0-or-later; for more details see the LICENSE file in the repository.

Usage

Currently, the library only supports pluralization:

import inflect;

assert("method".pluralize() == "methods");

Per default only the english pluralization backend is registered. To register your own:

import inflect;

class MyCustomInflections : Inflections {
    string pluralize(string inp, int count) shared const {
        // ...
    }
}

mixin RegisterInflections!("my-locale", MyCustomInflections);

Roadmap

  • support more inflection types like singularization
  • support more transformative actions like camelcase