more baics
This commit is contained in:
parent
0954301d8c
commit
5bcb7748b6
@ -21,3 +21,7 @@ path = "vec.rs"
|
||||
[[bin]]
|
||||
name = "strings"
|
||||
path = "strings.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "multilingual"
|
||||
path = "multilingual.rs"
|
||||
|
||||
BIN
multilingual
Executable file
BIN
multilingual
Executable file
Binary file not shown.
13
multilingual.rs
Normal file
13
multilingual.rs
Normal file
@ -0,0 +1,13 @@
|
||||
fn main() {
|
||||
let multilingual = "Hi! ¡Hola! привет!";
|
||||
let maybe = multilingual.find('п');
|
||||
|
||||
if maybe.is_some() {
|
||||
let hi = &multilingual[maybe.unwrap()..];
|
||||
let hio = &multilingual[11..13];
|
||||
println!("hio {}", hio);
|
||||
println!("hello russkov {}", hi)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -8,6 +8,7 @@ fn array_to_string(arr: &[i32]) -> String {
|
||||
res += ", "
|
||||
}
|
||||
res.pop();
|
||||
res.pop();
|
||||
res.push(']');
|
||||
res
|
||||
}
|
||||
@ -23,4 +24,6 @@ fn main() {
|
||||
|
||||
let arr2 = &[3, 2, 1, 0, -1];
|
||||
let res = array_to_string(arr2);
|
||||
let formated = format!("hello {}", res);
|
||||
println!("{}", formated);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user