[−][src]Crate scanner_rust
Scanner
This crate provides a Java-like Scanner which can parse primitive types and strings using UTF-8.
Example
extern crate scanner_rust; use scanner_rust::Scanner; let mut sc = Scanner::scan_slice(" 123 456.7 \t\r\n\n c中文字\n\tHello world!"); assert_eq!(Some(123), sc.next_u8().unwrap()); assert_eq!(Some(456.7), sc.next_f64().unwrap()); assert_eq!(Some(' '), sc.next_char().unwrap()); assert_eq!(Some(' '), sc.next_char().unwrap()); assert_eq!(true, sc.skip_whitespaces().unwrap()); assert_eq!(Some('c'), sc.next_char().unwrap()); assert_eq!(Some("中文字".into()), sc.next_line().unwrap()); assert_eq!(Some("\tHello world!".into()), sc.next_line().unwrap()); assert_eq!(None, sc.next_line().unwrap());
Besides, the drop_next
and drop_next_line
methods are useful when you want to skip some substrings.
Structs
Scanner | A simple text scanner which can parse primitive types and strings using UTF-8. |
Enums
ScannerError | The possible errors of the |