Hi all,
suppose i want to replace the i th character c (this character is ascii, so
represented by exactly one byte) in a String named buf with character 'a'
i can do this
buf =
buf.as_slice().slice_to(i).to_string().append("a").append(buf.as_slice().slice_from(i+1))
if c is any UTF8 character, i can use
buf =
buf.as_slice().slice_to(i).to_string().append("a").append(buf.as_slice().slice_from(i+c.len_utf8_bytes()))
It's quite complex, no better way to do ?
Any future additional methods for String are planned ?
Thanks
--
Christophe
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev