Skip to content

fixes in stringImproved#135

Open
gcask wants to merge 1 commit intodaid:masterfrom
gcask:string-improved-view-fixes
Open

fixes in stringImproved#135
gcask wants to merge 1 commit intodaid:masterfrom
gcask:string-improved-view-fixes

Conversation

@gcask
Copy link
Contributor

@gcask gcask commented Jul 1, 2021

  • single char variant now calls the string_view counterpart (ensures consistency)
  • fixed the find which was using the stock substr() and not the improved string ones, which has a different behavior (mostly about negative indices).

* single char variant now calls the string_view counterpart (ensures consistency)
* fixed the `find` which was using the stock `substr()` and not the improved string ones, which has a different behavior (mostly about negative indices).
}
bool endswith(char suffix) const
{
return !empty() && (*this)[length()-1] == suffix;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is interesting, because it meant that string{}.endswith("") != string{}.endswith('\0') (the string version assumes an empty string is always present at the end of a string)

@gcask
Copy link
Contributor Author

gcask commented Jul 1, 2021

Note: we should make more stuff use the substr_view() (like endswith!) but that's going to be a separate PR

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.

1 participant