(core::str) do some replacements

This commit is contained in:
Kevin Cantu 2012-02-22 23:26:09 -08:00 committed by Marijn Haverbeke
parent 2756a61e34
commit 280633a728
3 changed files with 9 additions and 8 deletions

View File

@ -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), }

View File

@ -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,

View File

@ -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))};
}
/*