-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy path06_string.rs
More file actions
24 lines (20 loc) · 793 Bytes
/
Copy path06_string.rs
File metadata and controls
24 lines (20 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
fn main () {
let name = "서태지" ; // This is a Korean name. No problem, because a &str is UTF-8.
let other_name = String::from("Adrian Fahrenheit Țepeș") ; // Ț and ș are no problem in UTF-8.
println!("{:?} {:?}", name, other_name) ;
let together = format!("1: {}, 2:{}", name, other_name) ;
println!("{}", together) ;
/*
println!("{:?} {:?}", name, other_name) ;
//dbg!(name, other_name) ;
*/
/*
println!("{} {} {}", name, std::mem::size_of_val(name), std::mem::size_of_val("서 태 지")) ;
*/
/*
println!("{} {}", std::mem::size_of_val(other_name), std::mem::size_of_val("Adrian Fahrenheit Țepeș")) ;
*/
/*
println!("{} {}", other_name.len(), std::mem::size_of_val("Adrian Fahrenheit Țepeș")) ;
*/
}