diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 5a879fb0cf8..ca7bb819443 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -72,8 +72,6 @@ export // Searching index, rindex, - index_byte, - rindex_byte, find, contains, starts_with, @@ -913,34 +911,6 @@ fn rindex(ss: str, cc: char) -> option { ret option::none; } -/* -Function: index - -Returns the index of the first matching byte. Returns -1 if -no match is found. - -FIXME: UTF-8 -*/ -fn index_byte(s: str, c: u8) -> int { - let i: int = 0; - for k: u8 in s { if k == c { ret i; } i += 1; } - ret -1; -} - -/* -Function: rindex - -Returns the index of the last matching byte. Returns -1 -if no match is found. - -FIXME: UTF-8 -*/ -fn rindex_byte(s: str, c: u8) -> int { - let n: int = byte_len(s) as int; - while n >= 0 { if s[n] == c { ret n; } n -= 1; } - ret n; -} - /* Function: find @@ -1521,20 +1491,6 @@ mod tests { assert (rindex("hello", 'z') == option::none); } - #[test] - fn test_index_byte() { - assert ( index_byte("hello", 'e' as u8) == 1); - assert ( index_byte("hello", 'o' as u8) == 4); - assert ( index_byte("hello", 'z' as u8) == -1); - } - - #[test] - fn test_rindex_byte() { - assert (rindex_byte("hello", 'l' as u8) == 3); - assert (rindex_byte("hello", 'h' as u8) == 0); - assert (rindex_byte("hello", 'z' as u8) == -1); - } - #[test] fn test_pop_char() { let data = "ประเทศไทย中华";