string_converters 1.0.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 72

String Converters

Build Status

I wrote this package since I realised I need this for quite a few projects when hitting dynamic code generation

This package helps you to convert the format of specific strings

Input string styles currently recognized

"Test Title", "Test word", "test Word", "table_name", 
"poly-name", "varName", "Title", "ClassName", "CONST_NAME"

Output should be

toVarName(string) ||
toLowerCamelCase(string)
"testTitle", "testWord", "testWord", "tableName", 
"polyName", "varName", "title", "className", "constName"

toClassName(string) ||
toUpperCamelCase(string)
"TestTitle", "TestWord", "TestWord", "TableName", 
"PolyName", "VarName", "Title", "ClassName", "ConstName"

toPolyName(string) || 
toLowerCaseWith(string,"-")
"test-title", "test-word", "test-word", "table-name", 
"poly-name", "var-name", "title", "class-name", "const-name"

toTableName(string) ||
toLowerCaseWith(string,"_")
"test_title", "test_word", "test_word", "table_name", 
"poly_name", "var_name", "title", "class_name", "const_name"

toConstName(string) ||
toUpperCaseWith(string,"_")
"TEST_TITLE", "TEST_WORD", "TEST_WORD", "TABLE_NAME", 
"POLY_NAME", "VAR_NAME", "TITLE", "CLASS_NAME", "CONST_NAME"

Example

  String polyName = toPolyName("CustomPolymerItem");

1.0.0

  • added functions:
toVarName(x)   <-> toLowerCamelCase(x)
toClassName(x) <-> toUpperCamelCase(x)
toConstName(x) <-> toUpperCaseWith(x,"_")
toTableName(x) <-> toLowerCaseWith(x,"_")
toPolyName(x)  <-> toLowerCaseWith(x,"-")

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  string_converters: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:string_converters/string_converters.dart';
  
Version Uploaded Documentation Archive
1.0.0 Aug 7, 2018 Go to the documentation of string_converters 1.0.0 Download string_converters 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
51
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
72
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:string_converters/string_converters.dart.

Health suggestions

Format lib/string_converters.dart.

Run dartfmt to format lib/string_converters.dart.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use string_converters.dart.

The description is too long. (-10 points)

Search engines will display only the first part of the description. Try to keep it under 180 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev <3.0.0
Dev dependencies
test ^1.0.0