diff options
| author | Kevin Cantu <me@kevincantu.org> | 2012-02-11 17:04:08 -0800 |
|---|---|---|
| committer | Kevin Cantu <me@kevincantu.org> | 2012-02-11 17:04:08 -0800 |
| commit | 207bb3d2df92f896145b3f2ef8aa5ca5cea00104 (patch) | |
| tree | 69d6f1313d100f8a2eae7c0eb0b6c2ca1ad69e12 /src | |
| parent | e0af23b664a1307fe376f2638bb7a69f04e2ac1c (diff) | |
| download | rust-207bb3d2df92f896145b3f2ef8aa5ca5cea00104.tar.gz rust-207bb3d2df92f896145b3f2ef8aa5ca5cea00104.zip | |
(core::str) removed [r]index_byte
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/str.rs | 44 |
1 files changed, 0 insertions, 44 deletions
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, @@ -914,34 +912,6 @@ fn rindex(ss: str, cc: char) -> option<uint> { } /* -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 Finds the index of the first matching substring. @@ -1522,20 +1492,6 @@ mod tests { } #[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 = "ประเทศไทย中华"; let cc = pop_char(data); |
