Skip to main content

String case converter.

Project description

Convert string cases between camel case, pascal case, snake case etc…

pypi_version_badge

About this fork

This is a manually created fork of the original stringcase by Taka Okunishi (@okunishinishi), intended to:

  • Fix failing tests

  • Modernize and simplify the packaging setup

  • Distribute a wheel on PyPI

Commits and merges from the original repository that were made after the last release have been moved onto a separate branch, and will be cherry-picked in as appropriate - where they actually fix bugs or move the project in the direction I intend.

Version numbers continue where the original left off, so that maintainers only need to change stringcase to stringcase-new in their pyproject.toml, requirements.txt etc. files.

The code continues to be available under an MIT license.

No meaningful new functionality is introduced, and the bugfixes are straightforward, so I assert no additional copyright.

This fork was prompted by recent ecosystem breakage resulting from the breaking change in Setuptools 78, which affected many users of this previously source-only project. Providing a wheel also greatly speeds up installation.

– Your humble maintainer, Karl Knechtel (@zahlman).

Usage

import stringcase
stringcase.camelcase('foo_bar_baz') # => "fooBarBaz"
stringcase.camelcase('FooBarBaz') # => "fooBarBaz"
stringcase.capitalcase('foo_bar_baz') # => "Foo_bar_baz"
stringcase.capitalcase('FooBarBaz') # => "FooBarBaz"
stringcase.constcase('foo_bar_baz') # => "FOO_BAR_BAZ"
stringcase.constcase('FooBarBaz') # => "_FOO_BAR_BAZ"
stringcase.lowercase('foo_bar_baz') # => "foo_bar_baz"
stringcase.lowercase('FooBarBaz') # => "foobarbaz"
stringcase.pascalcase('foo_bar_baz') # => "FooBarBaz"
stringcase.pascalcase('FooBarBaz') # => "FooBarBaz"
stringcase.pathcase('foo_bar_baz') # => "foo/bar/baz"
stringcase.pathcase('FooBarBaz') # => "/foo/bar/baz"
stringcase.sentencecase('foo_bar_baz') # => "Foo bar baz"
stringcase.sentencecase('FooBarBaz') # => "Foo bar baz"
stringcase.snakecase('foo_bar_baz') # => "foo_bar_baz"
stringcase.snakecase('FooBarBaz') # => "foo_bar_baz"
stringcase.spinalcase('foo_bar_baz') # => "foo-bar-baz"
stringcase.spinalcase('FooBarBaz') # => "-foo-bar-baz"
stringcase.titlecase('foo_bar_baz') # => "Foo Bar Baz"
stringcase.titlecase('FooBarBaz') # => " Foo Bar Baz"
stringcase.trimcase('foo_bar_baz') # => "foo_bar_baz"
stringcase.trimcase('FooBarBaz') # => "FooBarBaz"
stringcase.uppercase('foo_bar_baz') # => "FOO_BAR_BAZ"
stringcase.uppercase('FooBarBaz') # => "FOOBARBAZ"
stringcase.alphanumcase('_Foo., Bar') # =>'FooBar'
stringcase.alphanumcase('Foo_123 Bar!') # =>'Foo123Bar'

Install

Because I do not own the original PyPI project, a new PyPI name is required:

$ pip install stringcase-new

License

This software is released under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stringcase_new-1.2.2.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stringcase_new-1.2.2-py2.py3-none-any.whl (4.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file stringcase_new-1.2.2.tar.gz.

File metadata

  • Download URL: stringcase_new-1.2.2.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for stringcase_new-1.2.2.tar.gz
Algorithm Hash digest
SHA256 ea2df5aedd49b707a4d6dae416f27ec434a0b9d2bc76ee832d4795264bbfee3c
MD5 d6a537ceaad1c1ffeb1c6f5670a90aea
BLAKE2b-256 90d822eef37383cc71fba106c28d85a9eddcdba7fed238c09e34ce722fab4bc4

See more details on using hashes here.

File details

Details for the file stringcase_new-1.2.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for stringcase_new-1.2.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 be4a6137604355d527c80f310a8e638cf29d7016e8ff6d3ed0446e6483cf7c49
MD5 73bc495ded6c614b379e1d3ed1894bbe
BLAKE2b-256 1ab4c2f4b36159a6a19dad36666d03afda85f58e416efcd77455d3cbd910c600

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page