-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Implement findBetween()
, findBetweenFirst()
, and findBetweenLast()
Methods
#118
Implement findBetween()
, findBetweenFirst()
, and findBetweenLast()
Methods
#118
Conversation
PR Summary
|
533b58d
to
a0da80e
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #118 +/- ##
============================================
+ Coverage 99.74% 99.76% +0.01%
- Complexity 135 147 +12
============================================
Files 7 7
Lines 391 424 +33
============================================
+ Hits 390 423 +33
Misses 1 1
☔ View full report in Codecov by Sentry. |
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.
Looks good 👍
Can you also add new method to readme and add line to changelog?
a0da80e
to
15c821b
Compare
@vjik Done |
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.
It looks should be 2 ways to find a string between two strings:
- find to the first position.
- find to the last last position.
$htmlContent = "<div class='content'>Hello World</div><div class='content'>It's me</div>";
$content = StringHelper::findBetween($htmlContent, "<div class='content'>", "</div>");
What will be the result?
|
Seems My suggestion to implement both methods in one PR to avoid naming problems. It could be |
@Tigrov no, they are not the same.
|
@Tigrov Thank you. so I add the two other methods in this PR? or a separate one? |
👍 Better to add them to this PR to get them together |
ad29228
to
c544d77
Compare
findBetween
, findBetweenFirst()
, and findBetweenLast()
Methods
findBetween
, findBetweenFirst()
, and findBetweenLast()
MethodsfindBetween()
, findBetweenFirst()
, and findBetweenLast()
Methods
@Tigrov Done |
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 suggest make $end
argument optional (?string $end = null
) in all new methods. If $end
is null, then $end = $start
.
11d4bfd
to
b50d84a
Compare
075d69b
to
a3329c1
Compare
a3329c1
to
8227316
Compare
@salehhashemi1992 Thank you for PR 👍 |
Implement
findBetween()
,findBetweenFirst()
andfindBetweenLast()
methods to StringHelper to retrieve a substring that lies between two strings in different scenarios.findBetween()
method retrieves a substring that lies between the first occurrence of a specified start string and the last occurrence of a specified end string in the input string.Tests are included.
Usage
findBetweenFirst()
: Retrieves the first substring that lies between the specified start and end strings in the input string.findBetweenLast()
: Retrieves the last substring that lies between the specified start and end strings in the input string.