Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/strings #147

Merged
merged 12 commits into from
Apr 12, 2022
Merged

Feature/strings #147

merged 12 commits into from
Apr 12, 2022

Conversation

ghasemdev
Copy link
Contributor

@ghasemdev ghasemdev commented Nov 7, 2021

Add string function

  • buildString()
  • .toChar()
  • .orEmpty()
  • .title()
  • .count()
  • .partition()
  • .center(), .leftJustify() and .rightJustify()
  • .matches()
  • .isHttp
  • .urlEncoded
  • .urlDecoded

@ghasemdev
Copy link
Contributor Author

Hi, I have removed the console functions :)
@passsy

README.md Outdated

```dart
const text = 'welcome to my 2nd world';
print(text.title()); // Welcome To My 2nd World
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems to be a good addition to the recase package

README.md Outdated

```dart
print('http://www.example.com'.isHttp); // true
print('htt://www//'.isHttp); // false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not seeing the value tbh

```dart
const originalUrl = 'Hello Ladies + Gentlemen, a signed OAuth request!';
final encodedUrl = originalUrl.urlEncode;
// 'Hello%20Ladies%20+%20Gentlemen,%20a%20signed%20OAuth%20request!'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fantastic!


```dart
print('as'.matches(RegExp('^.s\$'))) // true
print('mst'.matches(RegExp('^.s\$'))) // false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it

README.md Outdated

```dart
const text = 'I love apples, apple are my favorite fruit';
print(text.count('apple', 0, 20)) // 2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too mixed. I'd split setting the range and counting.

Also, I could image count() to do many other things. Not a good name for this

README.md Outdated
```dart
const text = 'I could eat bananas all day';
print(text.partition('bananas') // ['I could eat ', 'bananas', ' all day']
print(text.partition('apple') // ['I could eat bananas all day', '', '']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of a String, we could inject a bool Function(index) to make it more general?

README.md Outdated
const text = 'banana';
print(text.center(2, '*')); // **banana**
print(text.leftJust(2, '*')); // **banana
print(text.rightJust(2, '*')); // banana**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how it is different from padLeft/padRight

Converts this value to character

```dart
final character = 97.toChar(); // a
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

# Conflicts:
#	README.md
#	lib/src/string.dart
#	test/string_test.dart
@codecov
Copy link

codecov bot commented Apr 12, 2022

Codecov Report

Merging #147 (2d58b25) into master (b1e352e) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #147      +/-   ##
==========================================
+ Coverage   97.81%   97.83%   +0.02%     
==========================================
  Files          13       13              
  Lines         777      787      +10     
==========================================
+ Hits          760      770      +10     
  Misses         17       17              
Impacted Files Coverage Δ
lib/src/num.dart 100.00% <100.00%> (ø)
lib/src/string.dart 100.00% <100.00%> (ø)

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@passsy passsy merged commit 1c43c45 into simc:master Apr 12, 2022
@passsy
Copy link
Collaborator

passsy commented Apr 12, 2022

For those, that did not make it immediately in, create new PRs :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants