-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Patch add str begins and ends #2049
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
Closed
wkhudgins92
wants to merge
112
commits into
php:master
from
wkhudgins92:patch-add-str_begins-and-ends
Closed
Changes from 11 commits
Commits
Show all changes
112 commits
Select commit
Hold shift + click to select a range
ab3b8b1
Added str_begins and str_ends
wkhudgins92 f89d8ed
Added support for case insensitive searches
wkhudgins92 19d3d86
changed capitalization of TRUE
wkhudgins92 bbced23
Passes test case now
wkhudgins92 764cb91
Added testing for str_ends
wkhudgins92 50524df
Passes tests cases
wkhudgins92 c00d31f
Fixed build error
wkhudgins92 0283a08
Split functions based on case sensitivity
wkhudgins92 73be337
Renamed str_begins to str_begins
wkhudgins92 4173d3a
Updated test code
wkhudgins92 65f9b81
Added case insensitive test cases
wkhudgins92 12ef0ed
Improved argument consistency and added additional test cases
wkhudgins92 d7ec807
Merge pull request #2 from php/master
wkhudgins92 18bb703
Merge branch 'master' into patch-add-str_begins-and-ends
wkhudgins92 4d1f7b8
Updated function parameter definitions
wkhudgins92 b37545f
Corrected verb conjugation in str_begins and str_ends
wkhudgins92 8263aea
Added mb_str_begins
wkhudgins92 db847f5
Merge branch 'master' of https://github.com/php/php-src
wkhudgins92 33c3de0
Resolved merge conflicts
wkhudgins92 b534efa
Fixed typo
wkhudgins92 c7ebb7c
Added mb_str_ibegins
wkhudgins92 e861268
Fixed call to PHP mb_stripos API
wkhudgins92 ccba7f3
Added mb_str_ends
wkhudgins92 a3dc5eb
Fixed call to member of mbfl_string struct
wkhudgins92 26c5721
Added mb_str_iends
wkhudgins92 02bbeef
Added test for mb_str_begins
wkhudgins92 bfa34f4
Added string to list of functions for mbstring
wkhudgins92 59e0081
Added Zend Arg info
wkhudgins92 71f7afa
Fixed typo in test case
wkhudgins92 4534840
Change needle in tesT
wkhudgins92 21caed8
Fixed syntax error
wkhudgins92 4a5e9b2
Removed incorrect text in mb_str_begins test
wkhudgins92 aa0aa2a
Added more tests for mb_str_i?(begins|ends)
wkhudgins92 f33f884
Changed approach for str_ends
wkhudgins92 9005a5c
Output the error code when an unknown error occurs in mb_strpos
wkhudgins92 433e8c4
Fixed finger typo
wkhudgins92 fa557a0
Corrected string output, remembered this is C and not PHP
wkhudgins92 363e4b6
Fixed format string
wkhudgins92 3cc6435
Update mbstring.c
wkhudgins92 60c8be8
Update mbstring.c
wkhudgins92 9d27d12
Update mbstring.c
wkhudgins92 cb82c1b
Update mbstring.c
wkhudgins92 edc593d
Update mbstring.c
wkhudgins92 e614fa2
Update mbstring.c
wkhudgins92 0d44f2b
Update mbstring.c
wkhudgins92 117d677
Update mb_str_ends.phpt
wkhudgins92 9a4c339
Corrected mb_str_iends test
wkhudgins92 0dbe537
Updated mb_str_iends
wkhudgins92 6938799
Added explicit checks for when needle is longer than haystack
wkhudgins92 90684da
Fixed indentation
wkhudgins92 21d1862
Fixed indentation
wkhudgins92 7fc90b6
Fixed indentation
wkhudgins92 ddf1dce
Added str_begins and str_ends
wkhudgins92 a334293
Added support for case insensitive searches
wkhudgins92 f7ff725
changed capitalization of TRUE
wkhudgins92 5514cd0
Passes test case now
wkhudgins92 cbe46ec
Added testing for str_ends
wkhudgins92 b6ec725
Passes tests cases
wkhudgins92 98ec7d6
Fixed build error
wkhudgins92 e0c6457
Split functions based on case sensitivity
wkhudgins92 0d3e608
Renamed str_begins to str_begins
wkhudgins92 c2f769a
Updated test code
wkhudgins92 dd8d8df
Added case insensitive test cases
wkhudgins92 66f55fa
Improved argument consistency and added additional test cases
wkhudgins92 0cec5e1
Updated function parameter definitions
wkhudgins92 9ef79ed
Corrected verb conjugation in str_begins and str_ends
wkhudgins92 ee628b4
Added mb_str_begins
wkhudgins92 7416d62
Fixed typo
wkhudgins92 a057122
Added mb_str_ibegins
wkhudgins92 7c42c2a
Fixed call to PHP mb_stripos API
wkhudgins92 923433b
Added mb_str_ends
wkhudgins92 6c48448
Fixed call to member of mbfl_string struct
wkhudgins92 7af64f2
Added mb_str_iends
wkhudgins92 eb14215
Added test for mb_str_begins
wkhudgins92 a80ccf1
Added string to list of functions for mbstring
wkhudgins92 39076dd
Added Zend Arg info
wkhudgins92 7110d90
Fixed typo in test case
wkhudgins92 308f0b6
Change needle in tesT
wkhudgins92 d85e113
Fixed syntax error
wkhudgins92 cdb74bc
Removed incorrect text in mb_str_begins test
wkhudgins92 4ed887e
Added more tests for mb_str_i?(begins|ends)
wkhudgins92 bd3485c
Changed approach for str_ends
wkhudgins92 1cc0c31
Output the error code when an unknown error occurs in mb_strpos
wkhudgins92 1322540
Fixed finger typo
wkhudgins92 6cdcb23
Corrected string output, remembered this is C and not PHP
wkhudgins92 315a201
Fixed format string
wkhudgins92 4bb52bc
Update mbstring.c
wkhudgins92 101f29b
Update mbstring.c
wkhudgins92 7ecc855
Update mbstring.c
wkhudgins92 a44574a
Update mbstring.c
wkhudgins92 6ce0ac1
Update mbstring.c
wkhudgins92 df0e11c
Update mbstring.c
wkhudgins92 1a9def4
Update mbstring.c
wkhudgins92 cb34fe0
Update mb_str_ends.phpt
wkhudgins92 857ca2a
Corrected mb_str_iends test
wkhudgins92 7a91516
Updated mb_str_iends
wkhudgins92 ccbba77
Added explicit checks for when needle is longer than haystack
wkhudgins92 af61e14
Fixed indentation
wkhudgins92 a685de6
Fixed indentation
wkhudgins92 10205e8
Fixed indentation
wkhudgins92 e7b6301
Merge branch 'patch-add-str_begins-and-ends' of github.com:wkhudgins9…
wkhudgins92 c3c6e2d
Renamed functions
wkhudgins92 07f690a
Renamed test files
wkhudgins92 4445f67
Renamd from begins with to starts with
wkhudgins92 c343678
Refactored naming format
wkhudgins92 c448a6d
Renamed test cases
wkhudgins92 08f1c1c
Fixed indentation
wkhudgins92 9b2bff4
Fixed return macros
wkhudgins92 ffe96ed
Replaced starts_with loops with memcmp calls
wkhudgins92 756ecbf
Removed unused variable
wkhudgins92 7b9217f
Turned str_starts_with_ci from memcmp to loop
wkhudgins92 70d0f39
Readded looping variable
wkhudgins92 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--TEST-- | ||
str_begin() function - unit tests for str_begin() | ||
--FILE-- | ||
<?php | ||
/* Prototype: boolean str_begin (string $search_value string $str); | ||
Description: Determine if $str begins with $search_value | ||
*/ | ||
$testStr = "beginningMiddleEnd"; | ||
var_dump(str_begin("beginning", $testStr)); | ||
var_dump(str_begin("Beginning", $testStr)); | ||
var_dump(str_begin("eginning", $testStr)); | ||
?> | ||
--EXPECT-- | ||
bool(true) | ||
bool(false) | ||
bool(false) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--TEST-- | ||
str_end() function - unit tests for str_end() | ||
--FILE-- | ||
<?php | ||
/* Prototype: boolean str_end (string $search_value string $str ); | ||
Description: Determine if $str ends with $search_value | ||
*/ | ||
$testStr = "beginningMiddleEnd"; | ||
var_dump(str_end("End", $testStr)); | ||
var_dump(str_end("end", $testStr)); | ||
var_dump(str_end("en", $testStr)); | ||
?> | ||
--EXPECT-- | ||
bool(true) | ||
bool(false) | ||
bool(false) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--TEST-- | ||
str_ibegin() function - unit tests for str_ibegin() | ||
--FILE-- | ||
<?php | ||
/* Prototype: boolean str_ibegin (string $search_value string $str); | ||
Description: Performs case insensitive check to determine if $str begins with $search_value | ||
*/ | ||
$testStr = "beginningMiddleEnd"; | ||
var_dump(str_ibegin("beginning", $testStr)); | ||
var_dump(str_ibegin("Beginning", $testStr)); | ||
var_dump(str_ibegin("eginning", $testStr)); | ||
?> | ||
--EXPECT-- | ||
bool(true) | ||
bool(true) | ||
bool(false) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--TEST-- | ||
str_iend() function - unit tests for str_iend() | ||
--FILE-- | ||
<?php | ||
/* Prototype: boolean str_iend (string $search_value string $str ); | ||
Description: Performs case insensitive check to Determine if $str ends with $search_value | ||
*/ | ||
$testStr = "beginningMiddleEnd"; | ||
var_dump(str_iend("End", $testStr)); | ||
var_dump(str_iend("end", $testStr)); | ||
var_dump(str_iend("en", $testStr)); | ||
?> | ||
--EXPECT-- | ||
bool(true) | ||
bool(true) | ||
bool(false) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
When the length of search_value is greater than str, maybe it will access out of bounds?
Uh oh!
There was an error while loading. Please reload this page.
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.
can you change the the interface to
bool str_begin(string $haytstack, $needle)
and boolstr_ends(string $haystack, string $needle)
for consistency with other string function like stristr, strpos, strrchr?