le mie informazioni di contatto
Posta[email protected]
2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
str
solitamente considerato come&str
preso in prestito.str
EString
Tutti sono codificati utf-8.let mut s = String::new()
let data = "initial contents";
let s = data.to_string();
let s = "initial contents".to_string();
let s = String::from("initial contents")
.let mut s = String::from("foo");
s.push_str("bar");
// s is foobar
push_str
Il metodo non cambia la proprietà della stringa
let mut s = String::from("lo");
s.push('l');
// s is lol
let s1 = String::from("Hello, ");
let s2 = String::from("world!");
let s3 = s1 + &s2; // note s1 has been moved here and can no longer be used
let s1 = String::from("tic");
let s2 = String::from("tac");
let s3 = String::from("toe");
let s = format!("{s1}-{s2}-{s3}");
Rust non consente la sottoscrizione per accedere ai singoli caratteri all'interno di una stringa
for c in "Зд".chars() {
println!("{c}");
}