(core::str) add a safe byte slice and maybe_slice ++

This commit is contained in:
Kevin Cantu 2012-02-22 01:16:47 -08:00 committed by Marijn Haverbeke
parent 7c78b7dfed
commit e1d04e0062
1 changed files with 1 additions and 1 deletions

View File

@ -401,8 +401,8 @@ fn substr(s: str, begin: uint, len: uint) -> str {
// beyond the last character of the string
fn slice(ss: str, begin: uint, end: uint) -> str {
alt maybe_slice(ss, begin, end) {
none { fail "slice requires a valid start and end"; }
some(sli) { ret sli; }
none { fail "slice requires a valid start and end"; }
}
}