pub fn string_def() {
let mut str = String::new();
let data = "hello world";
let s = data.to_string();
println!("{}", s);
let s = "initial contents".to_string();
println!("{}", s);
let s = String::from("initial contents");
println!("{}", s);
let mut s1 = String::from("foo");
let s2 = "bar";
s1.push_str(s2);
println!("s2 is {s2}");
let mut s = String::from("lo");
s.push('l');
println!("s is {s}");
let s1 = String::from("Hello, ");
let s2 = String::from("world!");
let s3 = s1 + &s2;
let s1 = String::from("tic");
let s2 = String::from("tac");
let s3 = String::from("toe");
let s = s1 + "-" + &s2 + "-" + &s3;
let s1 = String::from("tic");
let s2 = String::from("tac");
let s3 = String::from("toe");
let s = format!("{s1}-{s2}-{s3}");
let s1 = String::from("hello");
let hello = "Здравствуйте";
let answer = &hello.as_bytes()[0];
println!("{}", answer);
let hello = "Здравствуйте";
let s = &hello[0..4];
println!("{}", s);
for c in "Зд".chars() {
println!("{c}");
}
for b in "Зд".bytes() {
println!("{b}");
}
}