Created
December 3, 2015 03:42
-
-
Save alicemaz/cd21cc42b58b05c50b29 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let bytes = input.as_bytes(); | |
let mut raw = Vec::<u8>::with_capacity(input.len()); | |
for (offset, codepoint) in input.char_indices() { | |
let c = codepoint as u32; | |
if (c > 0x40 && c < 0x5b) || (c > 0x60 && c < 0x7b) || | |
(c > 0x29 && c < 0x3a) || c == 0x2b || c == 0x2f { | |
raw.push(bytes[offset]); | |
} else if codepoint.is_whitespace() || c == 0x3d { | |
; | |
} else { | |
panic!("change this to error when I add return type"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment