1
Fork 0

(core::str) rename substr_len_bytes to substr_len, and delete unused byte_index[_from]

This commit is contained in:
Kevin Cantu 2012-02-23 01:45:59 -08:00 committed by Marijn Haverbeke
parent 7782f5d692
commit c3318f29fe
3 changed files with 5 additions and 26 deletions

View file

@ -93,7 +93,7 @@ export
// Misc
// FIXME: perhaps some more of this section shouldn't be exported?
is_utf8,
substr_len_bytes,
substr_len,
substr_len_chars,
utf8_char_width,
char_range_at,
@ -914,27 +914,6 @@ fn index_chars(ss: str, cc: char) -> option<uint> {
ret none;
}
// Function: byte_index
//
// Returns the index of the first matching byte
// (as option some/none)
// FIXME: delete
fn byte_index(s: str, b: u8) -> option<uint> {
byte_index_from(s, b, 0u, len(s))
}
// Function: byte_index_from
//
// Returns the index of the first matching byte within the range [`start`,
// `end`).
// (as option some/none)
// FIXME: delete
fn byte_index_from(s: str, b: u8, start: uint, end: uint) -> option<uint> {
assert end <= len(s);
str::as_bytes(s) { |v| vec::position_from(v, start, end) { |x| x == b } }
}
// Function: rindex
//
// Returns the byte index of the first matching char