diff --git a/src/comp/syntax/codemap.rs b/src/comp/syntax/codemap.rs index c8b33687abe..0d1172b3502 100644 --- a/src/comp/syntax/codemap.rs +++ b/src/comp/syntax/codemap.rs @@ -171,7 +171,7 @@ fn lookup_byte_offset(cm: codemap::codemap, chpos: uint) let {fm,line} = lookup_line(cm,chpos,lookup); let line_offset = fm.lines[line].byte - fm.start_pos.byte; let col = chpos - fm.lines[line].ch; - let col_offset = str::substr_len_bytes(*fm.src, line_offset, col); + let col_offset = str::substr_len(*fm.src, line_offset, col); ret {fm: fm, pos: line_offset + col_offset}; } diff --git a/src/libcore/str.rs b/src/libcore/str.rs index c199ead460f..e4df5bafad6 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -93,7 +93,7 @@ export // Misc // FIXME: perhaps some more of this section shouldn't be exported? is_utf8, - substr_len_bytes, + substr_len, substr_len_chars, utf8_char_width, char_range_at, @@ -914,27 +914,6 @@ fn index_chars(ss: str, cc: char) -> option { ret none; } -// Function: byte_index -// -// Returns the index of the first matching byte -// (as option some/none) -// FIXME: delete -fn byte_index(s: str, b: u8) -> option { - byte_index_from(s, b, 0u, len(s)) -} - -// Function: byte_index_from -// -// Returns the index of the first matching byte within the range [`start`, -// `end`). -// (as option some/none) -// FIXME: delete -fn byte_index_from(s: str, b: u8, start: uint, end: uint) -> option { - assert end <= len(s); - - str::as_bytes(s) { |v| vec::position_from(v, start, end) { |x| x == b } } -} - // Function: rindex // // Returns the byte index of the first matching char diff --git a/src/libstd/rope.rs b/src/libstd/rope.rs index 81800afffa5..10144cc9731 100644 --- a/src/libstd/rope.rs +++ b/src/libstd/rope.rs @@ -795,7 +795,7 @@ mod node { if i == 0u { first_leaf_char_len } else { hint_max_leaf_char_len }; let chunk_byte_len = - str::substr_len_bytes(*str, offset, chunk_char_len); + str::substr_len(*str, offset, chunk_char_len); nodes[i] = @leaf({ byte_offset: offset, byte_len: chunk_byte_len, @@ -1059,9 +1059,9 @@ mod node { ret node; } let byte_offset = - str::substr_len_bytes(*x.content, 0u, char_offset); + str::substr_len(*x.content, 0u, char_offset); let byte_len = - str::substr_len_bytes(*x.content, byte_offset, char_len); + str::substr_len(*x.content, byte_offset, char_len); ret @leaf({byte_offset: byte_offset, byte_len: byte_len, char_len: char_len,