GitLab will be upgraded to the 12.10.14-ce.0 on 28 Sept 2020 at 2.00pm (AEDT) to 2.30pm (AEDT). During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to us at N110 (b) CSIT building.

string_utils.rs 354 Bytes
Newer Older
qinsoon's avatar
qinsoon committed
1 2 3 4 5 6 7 8 9 10 11
pub fn replace(s: &mut String, index: usize, replace: &String, replace_len: usize) {
    let vec = unsafe {s.as_mut_vec()};
    let vec_replace = replace.as_bytes();

    for i in 0..replace_len {
        if i < replace.len() {
            vec[index + i] = vec_replace[i] as u8;
        } else {
            vec[index + i] = ' ' as u8;
        }
    }
12
}