- Notifications
You must be signed in to change notification settings - Fork4
Dart library for changing String case style to the desired convention.
License
NotificationsYou must be signed in to change notification settings
Jesway/dart_casing
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Thedart_casing
package provides various casing utilities to convert strings between different cases. Below are the supported cases with examples:
Add this to your package's pubspec.yaml file:
dependencies: dart_casing:<latest version>
import'package:dart_casing/dart_casing.dart';main(){var text="Lorem-ipsum_dolor\\SIT amet";// Camel Caseprint(Casing.camelCase(text));// loremIpsumDolorSitAmetprint(Casing.camelCase("myPascalCaseWord"));// myPascalCaseWord// Pascal Caseprint(Casing.pascalCase(text));// LoremIpsumDolorSitAmetprint(Casing.pascalCase("myCamelCaseWord"));// MyCamelCaseWord// Title Caseprint(Casing.titleCase(text));// Lorem Ipsum Dolor Sit Ametprint(Casing.titleCase("my_snake_case_word"));// My Snake Case Word// Snake Caseprint(Casing.snakeCase(text));// lorem_ipsum_dolor_sit_ametprint(Casing.snakeCase("myCamelCaseWord"));// my_camel_case_word// Kebab Caseprint(Casing.kebabCase(text));// lorem-ipsum-dolor-sit-ametprint(Casing.kebabCase("MyPascalCaseWord"));// my-pascal-case-word// Dot Caseprint(Casing.dotCase(text));// lorem.ipsum.dolor.sit.ametprint(Casing.dotCase("myCamelCaseWord"));// my.camel.case.word// Constant Caseprint(Casing.constantCase(text));// LOREM_IPSUM_DOLOR_SIT_AMETprint(Casing.constantCase("myCamelCaseWord"));// MY_CAMEL_CASE_WORD// Lower Caseprint(Casing.lowerCase(text, separator:" "));// lorem ipsum dolor sit ametprint(Casing.lowerCase("MY_CONSTANT_CASE_WORD"));// my constant case word// Upper Caseprint(Casing.upperCase(text, separator:" "));// LOREM IPSUM DOLOR SIT AMETprint(Casing.upperCase("myCamelCaseWord"));// MY CAMEL CASE WORD}
The package handles various input formats, including
CamelCase
,PascalCase
,snake_case
,kebab-case
,dot.case
,Title Case
,CONSTANT_CASE
, and words separated by spaces or other symbols.You can also specify a custom separator for
titleCase
,lowerCase
, andupperCase
methods to join the words.
Please file any issues, bugs or feature requesthere.
This project is licensed under theMIT License