Function decoderWithIgnore [src]
Creates a new decoder that ignores certain characters.
The decoder will skip any characters that are in the ignore list.
The ignore list must not contain any valid hexadecimal characters.
Prototype
pub fn decoderWithIgnore(ignore_chars: []const u8) error{InvalidCharacter}!DecoderWithIgnore Parameters
ignore_chars: []const u8 Possible Errors
Source
pub fn decoderWithIgnore(ignore_chars: []const u8) error{InvalidCharacter}!DecoderWithIgnore {
var ignored_chars = StaticBitSet(256).initEmpty();
for (ignore_chars) |c| {
switch (c) {
'0'...'9', 'a'...'f', 'A'...'F' => return error.InvalidCharacter,
else => if (ignored_chars.isSet(c)) return error.InvalidCharacter,
}
ignored_chars.set(c);
}
return DecoderWithIgnore{ .ignored_chars = ignored_chars };
}