-
Notifications
You must be signed in to change notification settings - Fork 395
Add replace and deleteCharAt methods to StringBuilder and StringBuffer #1205
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
Add replace and deleteCharAt methods to StringBuilder and StringBuffer #1205
Conversation
Can one of the admins verify this patch? |
test this please |
@l15k4 Could you confirm that you didn't look at OpenJDK's code for this? |
@sjrd I looked at Oracle's JDK :-) |
Ach. Well, that's as much a problem. We can't accept code that's been derived from any JDK because their licenses are not compatible with ours (excluding Apache Harmony). :-( |
What I meant was that I adhered to the "protocol/spec" these methods have :
Not that I have copied the code... We work with String, they work with Char Arrays |
OK, I suppose that's fine. I'll repeat here my comment from #1106: |
@@ -67,6 +67,28 @@ class StringBuffer(private var content: String) extends CharSequence | |||
this | |||
} | |||
|
|||
def deleteCharAt(index: Int): StringBuffer = { | |||
if (index < 0 || index >= content.length) | |||
throw new IndexOutOfBoundsException("String index out of range: " + index) |
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.
_String_IndexOfBoundsException?
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.
Only this left to address.
And then, can you squash the commits, please? Fixup commits should always be squashed.
That's all. |
Done and Done :-) |
Thanks! |
d21b666
to
20973bc
Compare
LGTM |
test this please |
Test PASSed. |
Btw I have a suggestion regarding Character API, there is
This method is heavily used, for instance parser combinators lib is pretty much broken without this method implemented... So I think that it is better to have something than nothing :-) Wdyt ? Should I make another PR or should I work it around at the third party libs ? |
Test PASSed. |
Add replace and deleteCharAt methods to StringBuilder and StringBuffer
Just a quick question regarding living on the scalajs cutting edge, is there a way to publishLocal all projects, not just the aggregated ones? Like compiler, sbtPlugin, tools etc. I just always have to manually publishLocal each one and since I'm doing that not that regularly I always forget which need to be published |
Can one of the admins verify this patch? |
There's no direct way because some projects need to be published against your version of Scala (the aggregates) and some always with 2.10.4 (tools and sbtPlugin). So it's:
|
Hi, would you please merge these? Both work the same as the java.lang implementations. Thank you