(core::str) add a safe byte slice and maybe_slice ++
This commit is contained in:
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"; }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue