We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5cfb6bf commit 101ed5bCopy full SHA for 101ed5b
[refs]
@@ -1,2 +1,2 @@
1
---
2
-refs/heads/master: 2746d20c839df05b2c04663f19398b23eddac737
+refs/heads/master: d0ed2e384a3b90394ca0f160e21a4948a1dbccb0
trunk/src/lib/_str.rs
@@ -391,10 +391,14 @@ fn ends_with(str haystack, str needle) -> bool {
391
}
392
393
fn substr(str s, uint begin, uint len) -> str {
394
+ ret slice(s, begin, begin + len);
395
+}
396
+
397
+fn slice(str s, uint begin, uint end) -> str {
398
let str accum = "";
399
let uint i = begin;
- while (i < begin+len) {
- accum += unsafe_from_byte(s.(i));
400
+ while (i < end) {
401
+ push_byte(accum, s.(i));
402
i += 1u;
403
404
ret accum;
0 commit comments