Skip to content

Commit 101ed5b

Browse files
committed
---
yaml --- r: 2222 b: refs/heads/master c: d0ed2e3 h: refs/heads/master v: v3
1 parent 5cfb6bf commit 101ed5b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 2746d20c839df05b2c04663f19398b23eddac737
2+
refs/heads/master: d0ed2e384a3b90394ca0f160e21a4948a1dbccb0

trunk/src/lib/_str.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,10 +391,14 @@ fn ends_with(str haystack, str needle) -> bool {
391391
}
392392

393393
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 {
394398
let str accum = "";
395399
let uint i = begin;
396-
while (i < begin+len) {
397-
accum += unsafe_from_byte(s.(i));
400+
while (i < end) {
401+
push_byte(accum, s.(i));
398402
i += 1u;
399403
}
400404
ret accum;

0 commit comments

Comments
 (0)