From 207bb3d2df92f896145b3f2ef8aa5ca5cea00104 Mon Sep 17 00:00:00 2001 From: Kevin Cantu Date: Sat, 11 Feb 2012 17:04:08 -0800 Subject: [PATCH] (core::str) removed [r]index_byte --- src/libcore/str.rs | 44 -------------------------------------------- 1 file changed, 44 deletions(-) diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 5a879fb0cf83..ca7bb819443b 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -72,8 +72,6 @@ // 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 @@ fn test_rindex() { 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 = "ประเทศไทย中华";