@@ -841,6 +841,8 @@ Function: index
841
841
842
842
Returns the index of the first matching byte. Returns -1 if
843
843
no match is found.
844
+
845
+ FIXME: UTF-8
844
846
*/
845
847
fn index ( s : str , c : u8 ) -> int {
846
848
let i: int = 0 ;
@@ -853,6 +855,8 @@ Function: rindex
853
855
854
856
Returns the index of the last matching byte. Returns -1
855
857
if no match is found.
858
+
859
+ FIXME: UTF-8
856
860
*/
857
861
fn rindex ( s : str , c : u8 ) -> int {
858
862
let n: int = byte_len ( s) as int ;
@@ -874,6 +878,8 @@ needle - The string to look for
874
878
Returns:
875
879
876
880
The index of the first occurance of `needle`, or -1 if not found.
881
+
882
+ FIXME: UTF-8?
877
883
*/
878
884
fn find ( haystack : str , needle : str ) -> int {
879
885
let haystack_len: int = byte_len ( haystack) as int ;
@@ -1589,9 +1595,9 @@ mod tests {
1589
1595
1590
1596
#[ test]
1591
1597
fn test_unsafe_slice ( ) unsafe {
1592
- assert ( eq ( "ab" , slice ( "abc" , 0 u, 2 u) ) ) ;
1593
- assert ( eq ( "bc" , slice ( "abc" , 1 u, 3 u) ) ) ;
1594
- assert ( eq ( "" , slice ( "abc" , 1 u, 1 u) ) ) ;
1598
+ assert ( eq ( "ab" , unsafe :: slice_bytes ( "abc" , 0 u, 2 u) ) ) ;
1599
+ assert ( eq ( "bc" , unsafe :: slice_bytes ( "abc" , 1 u, 3 u) ) ) ;
1600
+ assert ( eq ( "" , unsafe :: slice_bytes ( "abc" , 1 u, 1 u) ) ) ;
1595
1601
fn a_million_letter_a ( ) -> str {
1596
1602
let i = 0 ;
1597
1603
let rs = "" ;
0 commit comments