mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
(core::str) do some replacements
This commit is contained in:
parent
2756a61e34
commit
280633a728
@ -286,8 +286,8 @@ fn check_variants_T<T: copy>(
|
||||
}
|
||||
|
||||
fn last_part(filename: str) -> str {
|
||||
let ix = option::get(str::rindex_chars(filename, '/'));
|
||||
str::slice_chars(filename, ix + 1u, str::len_chars(filename) - 3u)
|
||||
let ix = option::get(str::rindex(filename, '/'));
|
||||
str::slice(filename, ix + 1u, str::len_bytes(filename) - 3u)
|
||||
}
|
||||
|
||||
enum happiness { passed, cleanly_rejected(str), known_bug(str), failed(str), }
|
||||
|
@ -36,6 +36,7 @@ export
|
||||
bytes,
|
||||
chars,
|
||||
substr,
|
||||
slice,
|
||||
slice_chars,
|
||||
split,
|
||||
split_str,
|
||||
@ -72,8 +73,8 @@ export
|
||||
index_chars,
|
||||
byte_index,
|
||||
byte_index_from,
|
||||
//rindex,
|
||||
rindex_chars,
|
||||
rindex,
|
||||
//rindex_chars,
|
||||
find_chars,
|
||||
find_bytes,
|
||||
find_from_bytes,
|
||||
|
@ -34,18 +34,18 @@ type path = str;
|
||||
|
||||
fn splitDirnameBasename (pp: path) -> {dirname: str, basename: str} {
|
||||
let ii;
|
||||
alt str::rindex_chars(pp, os_fs::path_sep) {
|
||||
alt str::rindex(pp, os_fs::path_sep) {
|
||||
option::some(xx) { ii = xx; }
|
||||
option::none {
|
||||
alt str::rindex_chars(pp, os_fs::alt_path_sep) {
|
||||
alt str::rindex(pp, os_fs::alt_path_sep) {
|
||||
option::some(xx) { ii = xx; }
|
||||
option::none { ret {dirname: ".", basename: pp}; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret {dirname: str::slice_chars(pp, 0u, ii),
|
||||
basename: str::slice_chars(pp, ii + 1u, str::len_chars(pp))};
|
||||
ret {dirname: str::slice(pp, 0u, ii),
|
||||
basename: str::slice(pp, ii + 1u, str::len_bytes(pp))};
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user