(core::str) do some replacements
This commit is contained in:
parent
2756a61e34
commit
280633a728
3 changed files with 9 additions and 8 deletions
|
@ -286,8 +286,8 @@ fn check_variants_T<T: copy>(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn last_part(filename: str) -> str {
|
fn last_part(filename: str) -> str {
|
||||||
let ix = option::get(str::rindex_chars(filename, '/'));
|
let ix = option::get(str::rindex(filename, '/'));
|
||||||
str::slice_chars(filename, ix + 1u, str::len_chars(filename) - 3u)
|
str::slice(filename, ix + 1u, str::len_bytes(filename) - 3u)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum happiness { passed, cleanly_rejected(str), known_bug(str), failed(str), }
|
enum happiness { passed, cleanly_rejected(str), known_bug(str), failed(str), }
|
||||||
|
|
|
@ -36,6 +36,7 @@ export
|
||||||
bytes,
|
bytes,
|
||||||
chars,
|
chars,
|
||||||
substr,
|
substr,
|
||||||
|
slice,
|
||||||
slice_chars,
|
slice_chars,
|
||||||
split,
|
split,
|
||||||
split_str,
|
split_str,
|
||||||
|
@ -72,8 +73,8 @@ export
|
||||||
index_chars,
|
index_chars,
|
||||||
byte_index,
|
byte_index,
|
||||||
byte_index_from,
|
byte_index_from,
|
||||||
//rindex,
|
rindex,
|
||||||
rindex_chars,
|
//rindex_chars,
|
||||||
find_chars,
|
find_chars,
|
||||||
find_bytes,
|
find_bytes,
|
||||||
find_from_bytes,
|
find_from_bytes,
|
||||||
|
|
|
@ -34,18 +34,18 @@ type path = str;
|
||||||
|
|
||||||
fn splitDirnameBasename (pp: path) -> {dirname: str, basename: str} {
|
fn splitDirnameBasename (pp: path) -> {dirname: str, basename: str} {
|
||||||
let ii;
|
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::some(xx) { ii = xx; }
|
||||||
option::none {
|
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::some(xx) { ii = xx; }
|
||||||
option::none { ret {dirname: ".", basename: pp}; }
|
option::none { ret {dirname: ".", basename: pp}; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret {dirname: str::slice_chars(pp, 0u, ii),
|
ret {dirname: str::slice(pp, 0u, ii),
|
||||||
basename: str::slice_chars(pp, ii + 1u, str::len_chars(pp))};
|
basename: str::slice(pp, ii + 1u, str::len_bytes(pp))};
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue