字符向量转化为字符串
let arr: Vec<char> = vec!['h', 'e', 'l', 'l', 'o'];
let s:String = arr.iter().collect();
字符串转化为字符向量
let s:String = "hello".to_string();
let arr: Vec<char> = s.chars().collect();
1
共 0 条评论, 1 页
let arr: Vec<char> = vec!['h', 'e', 'l', 'l', 'o'];
let s:String = arr.iter().collect();
let s:String = "hello".to_string();
let arr: Vec<char> = s.chars().collect();
评论区
写评论还没有评论