minhas informações de contato
Correspondência[email protected]
2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
str
geralmente considerado como&str
emprestado.str
eString
Todos são codificados em 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
O método não altera a propriedade da string
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 não permite assinaturas para acessar caracteres individuais dentro de uma string
for c in "Зд".chars() {
println!("{c}");
}