(core::str) add a safe byte slice and maybe_slice ++
This commit is contained in:
committed by
Marijn Haverbeke
parent
7c78b7dfed
commit
e1d04e0062
@@ -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"; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user