내 연락처 정보
우편메소피아@프로톤메일.com
2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
str
일반적으로 다음과 같이 간주됩니다.&str
빌린.str
그리고String
모두 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
메서드는 문자열의 소유권을 변경하지 않습니다.
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는 첨자가 문자열 내의 개별 문자에 액세스하는 것을 허용하지 않습니다.
for c in "Зд".chars() {
println!("{c}");
}