I'm having trouble reversing a string in the newest version of rust, I saw this post but I'm still getting some errors. I'm trying to reverse a string and compare the two without any luck:
fn is_palindromic(num: int) -> bool {
let num_str = num.to_str();
let rev_num_str = num_str.chars_rev().collect();
if rev_num_str == num_str {
return true;
}else{
return false;
}
}
then I receive the error:
main.rs:8:28: 8:39 error: type `collections::string::String` does not implement
any method in scope named `chars_rev`
main.rs:8 let rev_num_str = num_str.chars_rev();