-
Notifications
You must be signed in to change notification settings - Fork 179
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
Use String#replace whenever possible #1045
Conversation
PR Summary
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #1045 +/- ##
============================================
+ Coverage 92.23% 92.32% +0.08%
- Complexity 2764 2767 +3
============================================
Files 291 291
Lines 5541 5540 -1
Branches 600 600
============================================
+ Hits 5111 5115 +4
+ Misses 274 272 -2
+ Partials 156 153 -3 ☔ View full report in Codecov by Sentry. |
@@ -91,7 +91,7 @@ public String domainName() { | |||
} | |||
|
|||
public String domainWord() { | |||
return FakerIDN.toASCII(SINGLE_QUOTE.matcher(faker.name().lastName().toLowerCase()).replaceAll("")); | |||
return FakerIDN.toASCII(faker.name().lastName().toLowerCase().replace("'", "")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't lowercase here at least use Locale.ROOT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here it's name generated base on locale set by user, so in case it iis e.g. TR it should be being lower cased to turkish lowercase. Thus i think here it is ok to have locale from faker's context
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it using fakers context when not passed though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, good catch,
added locale from context
thanks
@@ -145,7 +145,7 @@ public String webdomain() { | |||
"www", | |||
".", | |||
FakerIDN.toASCII( | |||
SINGLE_QUOTE.matcher(faker.name().firstName().toLowerCase()).replaceAll("") + | |||
faker.name().firstName().toLowerCase().replace("'", "") + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also added locale from context
Thanks! |
If there is no need to replace by regexp then there is
String#replace
which is much faster thanreplaceAll
, thus it's better to use it instead