Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- println!("{:?}", {
- let s = "今日は"; let n = 2; let (c, i) = s.char_indices().nth(n).unwrap(); &s[0..(i + c.len_utf8())]
- });
- }
- /* ~~~~=== stderr ===~~~~
- Compiling playground v0.0.1 (file:///playground)
- error[E0599]: no method named `len_utf8` found for type `usize` in the current scope
- --> src/main.rs:5:95
- |
- 5 | let s = "今日は"; let n = 2; let (c, i) = s.char_indices().nth(n).unwrap(); &s[0..(i + c.len_utf8())]
- | ^^^^^^^^
- error[E0369]: binary operation `+` cannot be applied to type `char`
- --> src/main.rs:5:88
- |
- 5 | let s = "今日は"; let n = 2; let (c, i) = s.char_indices().nth(n).unwrap(); &s[0..(i + c.len_utf8())]
- | ^^^^^^^^^^^^^^^^^^
- |
- = note: an implementation of `std::ops::Add` might be missing for `char`
- error: aborting due to 2 previous errors
- Some errors occurred: E0369, E0599.
- For more information about an error, try `rustc --explain E0369`.
- error: Could not compile `playground`.
- To learn more, run the command again with --verbose.
- */
- /* ~~~~=== stdout ===~~~~
- */
Add Comment
Please, Sign In to add comment