-
Notifications
You must be signed in to change notification settings - Fork 5.4k
[DOC] Tweaks for String#count #13839
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
Conversation
doc/string/count.rdoc
Outdated
s.count('abc', 'def') # => 0 | ||
s.count('') # => 0 | ||
|
||
Selectors may include negations, ranges, and escapes: |
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.
What do you mean by "escapes"? Like "\n"
? That's a feature of the string rather than String#count
.
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.
Not sure what "escapes" is supposed to mean. It's mentioned in the previous documentation, though. What do you thinki?
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.
Looking at the original documentation, it means escaping the special characters like ^
and -
"1^2^3".count("\\^1") # => 3
"^-^".count("\\^\\-") # => 3
@peterzhu2118, on second thought, maybe it's better to retain file Maybe review that file for possible improvements, and add/revise the examples in its nine referring methods? If agreed, I'll close this PR. |
It's your call, but I think there's only 3 other places that use it ( |
I'm rethinking this. |
Re-rethinking this. And marking as draft. |
I'd like to get rid of file
doc/character_selectors.rdoc
. I think it's better for the methods' documentation to handle things on their own (as I've shown here).Right now, it's also referred to at:
#delete
/delete!
.#squeeze/#squeeze!
.When these are all 'tweaked', those references will be gone and we can delete the file.