Closed
Description
Proposed new str
or String
API
String::insert_str(&mut self, index: usize, s: &str)
Just likeinsert(&mut self, usize, char)
, but for a string piece. Insertion is inherently inefficient, but this impl will be better than the user having to create an entirely new String.String::splice<R>(&mut self, range: R, s: &str)
Combinedrain
andinsert_str
, allow both removing a range and replacing it with a new string in one operation. Removerange
, inserts
atrange.start
.str::repeat(&self, n: usize) -> String
Convenience to repeat a String. Will size the result correctly up front, so it's both simpler and faster than in-code iterator based solutions.