(core::str) add a safe byte slice and maybe_slice ++
This commit is contained in:
parent
7c78b7dfed
commit
e1d04e0062
1 changed files with 1 additions and 1 deletions
|
@ -401,8 +401,8 @@ fn substr(s: str, begin: uint, len: uint) -> str {
|
||||||
// beyond the last character of the string
|
// beyond the last character of the string
|
||||||
fn slice(ss: str, begin: uint, end: uint) -> str {
|
fn slice(ss: str, begin: uint, end: uint) -> str {
|
||||||
alt maybe_slice(ss, begin, end) {
|
alt maybe_slice(ss, begin, end) {
|
||||||
none { fail "slice requires a valid start and end"; }
|
|
||||||
some(sli) { ret sli; }
|
some(sli) { ret sli; }
|
||||||
|
none { fail "slice requires a valid start and end"; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue