Skip to content

Commit 207bb3d

Browse files
committed
(core::str) removed [r]index_byte
1 parent e0af23b commit 207bb3d

File tree

1 file changed

+0
-44
lines changed

1 file changed

+0
-44
lines changed

src/libcore/str.rs

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ export
7272
// Searching
7373
index,
7474
rindex,
75-
index_byte,
76-
rindex_byte,
7775
find,
7876
contains,
7977
starts_with,
@@ -913,34 +911,6 @@ fn rindex(ss: str, cc: char) -> option<uint> {
913911
ret option::none;
914912
}
915913

916-
/*
917-
Function: index
918-
919-
Returns the index of the first matching byte. Returns -1 if
920-
no match is found.
921-
922-
FIXME: UTF-8
923-
*/
924-
fn index_byte(s: str, c: u8) -> int {
925-
let i: int = 0;
926-
for k: u8 in s { if k == c { ret i; } i += 1; }
927-
ret -1;
928-
}
929-
930-
/*
931-
Function: rindex
932-
933-
Returns the index of the last matching byte. Returns -1
934-
if no match is found.
935-
936-
FIXME: UTF-8
937-
*/
938-
fn rindex_byte(s: str, c: u8) -> int {
939-
let n: int = byte_len(s) as int;
940-
while n >= 0 { if s[n] == c { ret n; } n -= 1; }
941-
ret n;
942-
}
943-
944914
/*
945915
Function: find
946916
@@ -1521,20 +1491,6 @@ mod tests {
15211491
assert (rindex("hello", 'z') == option::none);
15221492
}
15231493

1524-
#[test]
1525-
fn test_index_byte() {
1526-
assert ( index_byte("hello", 'e' as u8) == 1);
1527-
assert ( index_byte("hello", 'o' as u8) == 4);
1528-
assert ( index_byte("hello", 'z' as u8) == -1);
1529-
}
1530-
1531-
#[test]
1532-
fn test_rindex_byte() {
1533-
assert (rindex_byte("hello", 'l' as u8) == 3);
1534-
assert (rindex_byte("hello", 'h' as u8) == 0);
1535-
assert (rindex_byte("hello", 'z' as u8) == -1);
1536-
}
1537-
15381494
#[test]
15391495
fn test_pop_char() {
15401496
let data = "ประเทศไทย中华";

0 commit comments

Comments
 (0)