-
Notifications
You must be signed in to change notification settings - Fork 217
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
Methods to work with SubStrings, find Offsets and Evaluate String Contents #87
Conversation
…uate string contents. fixes danielstjules#86 offsetOfSubstr(); offsetOfLastSubstr(); isEmpty(); containsInt(); constainsFloat(); substringAfterFirst(); substringAfterLast(); substringBeforeFirst(); substringBeforeLast();
I appreciate you taking the time for PHP 5.3 support. I realize it's been EOL'ed, but I'd rather not release a new major to drop support. I'll take a look at the PR :) |
It was about a 2-line fix after knowing what was going on, so not a big deal there. I was more concerned about the performance impact of this fix than anything else... Waiting your feedback! |
Any news on this request? |
Sure, sorry again! I'm not sure I see the benefit of isEmpty, containsInt, and constainsFloat (should be containsFloat). Do you find yourself needing a multibyte string library for that kind of stuff? Also, is containsFloat a bit complicated - can't you use floatval? Or are does it not work in the case of some encodings, or mismatch?
I like the idea of strpos/strrpos methods (which you named offsetOfSubstr/offsetOfLastSubstr), but I might change their name to be more concise, or even combine them. I'm wondering if they could maybe become As for the substring(Before/After)(First/Last) methods, I think I'd rather leave them out, and maybe recommend their usage/inclusion as part of a subclass. If you wanted to include them in a separate lib, I'd be happy to link to it in https://github.com/danielstjules/Stringy#links :) |
Hi!
Waiting your feedback! |
@danielstjules I really would like some feedback on the last message to decide what to do. Thanks. |
I disagree. You still have to do the comparison every time, since they're not chainable.
Not only is the comparison shorter, but the behavior is a lot more clear, as I'm not having to look up the implementation or signature for some method.
Your example test cases didn't show an example with multiple separators. Beyond that, I don't think it's a necessary divergence from the standard lib.
Fair point :) I was thinking something along the lines of: Basically, I really like the idea of the index method, but I think I'd rather the others live in a project outside the core lib. It's already quite cluttered, though that's my fault. :) |
…() substringAfterLast() substringBeforeFirst() substringBeforeLast(); Renames: offsetOfSubstr() to indexOf() and offsetOfLastSubstr() oto indexOfLast();
I've made the changes we talked about: Removed: Can you check if it can be merged? Thank you. |
Hello! Any news on the PR? I've also created another project with the removed SubString methods, available here: https://github.com/TCB13/SubStringy Have a nice day ;) |
Thanks! I added it to the links https://github.com/danielstjules/Stringy#links :) |
I'm still struggling with the name. It's not really last, but reverse. Do you mind if I pickup your branch? Thanks a lot for all you work on this btw :) |
Yeah sure, but please note that SubStringy needs the methods Thanks! |
Merged in, thank you for your work on this, and for your patience! I realize I haven't been the most responsive. I came around on the |
Great! Glad to help. |
Added multiple methods to work with substrings, find offsets and evaluate string contents. fixes #86