https://github.com/thitlwincoder/lazy_string
This package can help people who are lazier and beginner to the faster when they use String and make a lot of function.
https://github.com/thitlwincoder/lazy_string
Last synced: 8 months ago
JSON representation
This package can help people who are lazier and beginner to the faster when they use String and make a lot of function.
- Host: GitHub
- URL: https://github.com/thitlwincoder/lazy_string
- Owner: thitlwincoder
- License: mit
- Created: 2021-03-22T17:06:46.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-12T02:20:01.000Z (almost 3 years ago)
- Last Synced: 2023-08-20T22:29:22.720Z (almost 3 years ago)
- Language: Dart
- Homepage: https://pub.dev/packages/lazy_string
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# lazy_string
[](https://pub.dev/packages/lazy_string)
[](https://github.com/thitlwincoder/lazy_string/commits/master)
[](https://github.com/thitlwincoder/lazy_string)
[](https://github.com/thitlwincoder/lazy_string/blob/master/LICENSE)
[](https://github.com/thitlwincoder)
This package can help people who are _lazier_ and _beginner_ to the faster when they use `String` and make a lot of function.
## Usage
### camelize(String text) => String
Converts underscored or dasherized String to a camelized one. Begins with a lower case letter unless it starts with an underscore, dash or an upper case letter.
```dart
LazyString.camelize('lazy-string');
// => "lazyString"
LazyString.camelize('-lazy-string');
// => "LazyString"
LazyString.camelize('_lazy_string');
// => "LazyString"
LazyString.camelize('Lazy_string');
// => "LazyString"
```
### underscored(String text) => String
Converts a camelized or dasherized String into an underscored one.
```dart
LazyString.underscored('LazyString');
// => "lazy_string"
```
### dasherize(String text) => String
Converts a underscored or camelized String into an dasherized one.
```dart
LazyString.dasherize('LazyString');
// => "-lazy-string"
```
### humanize(String text) => String
Converts an underscored, camelized, or dasherized String into a humanized one. Also removes beginning and ending whitespace, and removes the postfix '_id'.
```dart
LazyString.humanize(' capitalize dash-CamelCase_underscore trim ');
// => "Capitalize dash camel case underscore trim"
```
### words(String text, {String delimiter}) => List\
Split string by delimiter (String or Pattern), /\s+/ by default.
```dart
LazyString.words(" lazy string ");
// => ["lazy", "string"]
LazyString.words("lazy_string", delimiter: "_");
// => ["lazy", "string"]
LazyString.words(" ")
// => []
```
### chars(String text) => List\
```dart
LazyString.chars('lazystring');
// => ["l", "a", "z", "y", "s", "t", "r", "i", "n", "g"]
```
### repeat(String text, {int count, String separator}) => String
Repeats a string count times.
```dart
LazyString.repeat("lazy", count: 3);
// => "lazylazylazy"
LazyString.repeat('lazy', count: 2, separator: 'string');
// => "lazystringlazy"
```
### count(String text, String char) => int
Returns int of occurrences of char in String.
```dart
LazyString.count("Hello world", "l");
// => 3
```
### reverse(String text) => String
Return reversed string.
```dart
LazyString.reverse('Music 𝄞 make happy');
// => "yppah ekam 𝄞 cisuM"
```
### clean(String text) => String
Trim and replace multiple spaces with a single space.
```dart
LazyString.clean(' lazy string ');
// => "lazy string"
```
### classify(String text) => String
Converts string to camelized class name. First letter is always upper case
```dart
LazyString.classify('lazy_string');
// => "LazyString"
```
## Contribution
Feel free to file an [issue](https://github.com/thitlwincoder/lazy_string/issues/new) if you find a problem or make pull requests.
All contributions are welcome :)