Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

reverse a string with runes

// Reverse a string with runes
fn main() {
    let r: String = "一二三四五六七八九十".chars().rev().collect();
    println!("original    {:?}", "一二三四五六七八九十");
    println!("reverse r = {:?}", "一二三四五六七八九十");    
    assert_eq!(r, "十九八七六五四三二一");
}
Source by rosettacode.org #
 
PREVIOUS NEXT
Tagged: #reverse #string #runes
ADD COMMENT
Topic
Name
4+6 =