reverse a string with runes
runes := []rune(s)
for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
runes[i], runes[j] = runes[j], runes[i]
}
t := string(runes)
reverse a string with runes
runes := []rune(s)
for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
runes[i], runes[j] = runes[j], runes[i]
}
t := string(runes)
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, "十九八七六五四三二一");
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us