File tree Expand file tree Collapse file tree 1 file changed +0
-44
lines changed Expand file tree Collapse file tree 1 file changed +0
-44
lines changed Original file line number Diff line number Diff line change 72
72
// Searching
73
73
index,
74
74
rindex,
75
- index_byte,
76
- rindex_byte,
77
75
find,
78
76
contains,
79
77
starts_with,
@@ -913,34 +911,6 @@ fn rindex(ss: str, cc: char) -> option<uint> {
913
911
ret option:: none;
914
912
}
915
913
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
-
944
914
/*
945
915
Function: find
946
916
@@ -1521,20 +1491,6 @@ mod tests {
1521
1491
assert ( rindex ( "hello" , 'z' ) == option:: none) ;
1522
1492
}
1523
1493
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
-
1538
1494
#[ test]
1539
1495
fn test_pop_char ( ) {
1540
1496
let data = "ประเทศไทย中华" ;
You can’t perform that action at this time.
0 commit comments