Crates.io | splitty |
lib.rs | splitty |
version | 1.0.2 |
source | src |
created_at | 2020-12-18 11:52:56.766787 |
updated_at | 2024-08-03 16:26:05.312321 |
description | a string splitter taking quotes into account |
homepage | |
repository | https://github.com/Canop/splitty |
max_upload_size | |
id | 324311 |
size | 9,701 |
A no-std string splitter for which spaces between quotes aren't separators.
Quotes not starting or ending a substring are handled as ordinary characters.
use splitty::*;
let cmd = "xterm -e \"vi /some/path\"";
let mut token = split_unquoted_char(cmd, ' ')
.unwrap_quotes(true);
assert_eq!(token.next(), Some("xterm"));
assert_eq!(token.next(), Some("-e"));
assert_eq!(token.next(), Some("vi /some/path"));