Giter VIP home page Giter VIP logo

tocase's Introduction

RB toCase

Cover

made by: RickBarreto

What is it?

RB toCase is a Case converter made in python, for peoples who wants simplify this feature. It can convert to and from Camel, Pascal, Snake, Kebab and Strings Sentences. And, You don't need say what is the input type, the code parse it. Just say whats is the output type.

Older name was toCase, but when I was publishing on Pipy tocase package already exists. So I changed the name!

Why I must to use it?

  • toCase was made to make easy your life with case converting
  • I was made in python, so, if you want, you can copy the toCase.py and use in your project. It's free to use, look the MIT LICENSE.

Glossary:

Installing

$ poetry add rb_tocase

or

$ pip install rb_tocase

Examples:

Importing:

>>> from rb_tocase import Case
>>> # or
>>> from rb_tocase import *
>>> # see the examples below

Convert to Camel Case:

>>> Case.to_camel("Changing to CaMel CASE")   # From String Sentence
'changingToCamelCase'
>>> Case.to_camel("Changing-to-camel-case")   # From Kebab Case
'changingToCamelCase'
>>> Case.to_camel("Changing_to_CAMEL_CASE")   # From Snake Case
'changingToCamelCase'
>>> Case.to_camel(" ChangingToCamelCase  ")   # From Pascal Case
'changingToCamelCase'

Convert to Snake Case:

>>> Case.to_snake(" ChanginToSnakeCase ")     # From Pascal Case
'changin_to_snake_case'
>>> Case.to_snake(" Changin To Snake Case ")  # From String
'changin_to_snake_case'
>>> Case.to_snake(" Changin-To-Snake-Case ")  # From Kebab
'changin_to_snake_case'
>>> Case.to_snake(" changinToSnakeCase ")     # From Camel
'changin_to_snake_case'

See more

Convert to Kebab Case:

>>> Case.to_kebab("Changing to Kebab")    # From String
'changing-to-kebab'
>>> Case.to_kebab("ChangingToKebab")      # From Pascal Case
'changing-to-kebab'
>>> Case.to_kebab("changingToKebab")      # From Camel Case
'changing-to-kebab'
>>> Case.to_kebab("changing_to_kebab")    # From Snake Case
'changing-to-kebab'

See more

Convert to Pascal Case:

>>> Case.to_pascal("Changing to Pascal")  # From String
'ChangingToPascal'
>>> Case.to_pascal("Changing-to-Pascal")  # From Kebab
'ChangingToPascal'
>>> Case.to_pascal("Changing_to_Pascal")  # From Snake
'ChangingToPascal'
>>> Case.to_pascal("ChangingtoPascal")    # From Pascal
'ChangingtoPascal'
>>> Case.to_pascal("changingToPascal") # From Camel
'ChangingToPascal'

Convert to Sentence:

>>> Case.to_sentence("ItsAPascalCase")
'its a pascal case'
>>> Case.to_sentence("itsACamelCase")
'its a camel case'
>>> Case.to_sentence("Its-A-Kebab-Case")
'its a snake case'
>>> Case.to_sentence("Its_a_snake_case")
'its a snake case'

Read The Docs!

Documentation

tocase's People

Contributors

rickbarretto avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

tocase's Issues

Importing causes an error

print(Case.toCamel("helloworld"))

This particular line causes an exception upon import

Traceback (most recent call last):
  File "toCase/toCase/tocase.py", line 340, in <module>
    print(Case.toCamel("helloworld"))
  File "toCase/toCase/tocase.py", line 64, in toCamel
    Case._Error()
  File "toCase/toCase/tocase.py", line 34, in _Error
    raise ValueError("case is wrong, choose between: 'lower', 'upper' or 'title'")
ValueError: case is wrong, choose between: 'lower', 'upper' or 'title'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.