All Projects → jawira → case-converter

jawira / case-converter

Licence: MIT license
Convert strings between 13 naming conventions: Snake case, Camel case, Kebab case, Pascal case, Ada case, Train case, Cobol case, Macro case, Upper case, Lower case, Title case, Sentence case and Dot notation.

Programming Languages

PHP
23972 projects - #3 most used programming language
Gherkin
971 projects

Projects that are alternatives of or similar to case-converter

go-strcase
Convert snake case, camel case and kebap case strings
Stars: ✭ 66 (-55.41%)
Mutual labels:  camel-case, kebab-case, snake-case
stringy
Convert string to camel case, snake case, kebab case / slugify, custom delimiter, pad string, tease string and many other functionalities with help of by Stringy package.
Stars: ✭ 137 (-7.43%)
Mutual labels:  camel-case, kebab-case, snake-case
pascalcase
Convert a string to pascal case (upper camel case). Used by more than 8.7 million projects on GitHub! Please follow this library's author: https://github.com/jonschlinkert
Stars: ✭ 35 (-76.35%)
Mutual labels:  camel-case, pascal-case
python-string-utils
A handy Python library to validate, manipulate and generate strings
Stars: ✭ 47 (-68.24%)
Mutual labels:  snake-case
camelcaseplugin
CamelCasePlugin for IDEA IDEs
Stars: ✭ 49 (-66.89%)
Mutual labels:  snake-case
ap-style-title-case
Convert a value to AP/APA title case
Stars: ✭ 34 (-77.03%)
Mutual labels:  title-case
alfred-string-operations
Perform string operations to clipboard content
Stars: ✭ 70 (-52.7%)
Mutual labels:  kebab-case
recase
♻️ Convert strings to any case.
Stars: ✭ 183 (+23.65%)
Mutual labels:  snake-case
axios-case-converter
Axios transformer/interceptor that converts snake_case/camelCase
Stars: ✭ 114 (-22.97%)
Mutual labels:  snake-case
strings-case
Convert strings between different cases.
Stars: ✭ 65 (-56.08%)
Mutual labels:  convert-strings

Case converter

Use this library to convert string between:

Name Method Output example
🐪 Camel case toCamel() myNameIsBond
👨‍🏫 Pascal case toPascal() MyNameIsBond
🐍 Snake case toSnake() my_name_is_bond
👩‍🏫 Ada case toAda() My_Name_Is_Bond
Ⓜ️ Macro case toMacro() MY_NAME_IS_BOND
🥙 Kebab case toKebab() my-name-is-bond
🚂 Train case toTrain() My-Name-Is-Bond
🏦 Cobol case toCobol() MY-NAME-IS-BOND
🔡 Lower case toLower() my name is bond
🔠 Upper case toUpper() MY NAME IS BOND
📰 Title case toTitle() My Name Is Bond
✍️ Sentence case toSentence() My name is bond
⚙️ Dot notation toDot() my.name.is.bond

Features:

Packagist Version Packagist PHP Version Support Packagist Downloads Packagist License
Maintainability Test Coverage

Usage

Input string (i.e. john-connor) format is going to be detected automatically. Here's an example:

use Jawira\CaseConverter\Convert;

$hero = new Convert('john-connor');

echo $hero->toCamel();   // output: johnConnor

Of course you can explicitly set the format of input string:

echo $hero->fromKebab()->toSnake();   // output: john_connor

You can also use the provided factory to instantiate Convert class. A list of all public methods is also available.

i18n

Fully compatible with non-english alphabets:

// Spanish
$esp = new Convert('DON_RAMÓN_Y_ÑOÑO');
echo $esp->toCamel();   // output: donRamónYÑoño

// Greek
$grc = new Convert('πολύ-Καλό');
echo $grc->toCamel();   // output: πολύΚαλό

// Russian
$rus = new Convert('ОЧЕНЬ_ПРИЯТНО');
echo $rus->toCamel();   // output: оченьПриятно

case-converter is compatible with Simple Case-Mapping and Full Case-Mapping. Learn more about Case-Mapping.

Installation

composer require jawira/case-converter

Documentation

https://jawira.github.io/case-converter/

Contributing

  • If you liked this project, star it on GitHub. GitHub Repo stars
  • Or follow me on Twitter. Twitter Follow

License

This library is licensed under the MIT LICENSE.


Packages from jawira

jawira/emoji-catalog GitHub stars
Get access to +3000 emojis as class constants.
jawira/plantuml-client GitHub stars
Convert PlantUML diagrams into images (svg, png, ...).
jawira/doctrine-diagram-bundle GitHub stars
Symfony Bundle to generate database diagrams.
more...
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].