Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Custom deliminator #35

Closed
pbsds opened this issue Mar 20, 2023 · 1 comment
Closed

Feature request: Custom deliminator #35

pbsds opened this issue Mar 20, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@pbsds
Copy link

pbsds commented Mar 20, 2023

a possible use case could be to filter nested class names or attributes, i.e. strings on the form foo.bar.baz.

Would you consider adding support for configuring the deliminator?

@natecraddock natecraddock added the enhancement New feature or request label Mar 20, 2023
@natecraddock
Copy link
Owner

Yep! I can add this to the next release.

I've actually had support for arbitrary delimiters in the code since the beginning, I just haven't exposed it as a flag yet.

zf/src/filter.zig

Lines 14 to 22 in 6624df5

/// read the candidates from the buffer
pub fn collectCandidates(allocator: std.mem.Allocator, buf: []const u8, delimiter: u8) ![][]const u8 {
var candidates = ArrayList([]const u8).init(allocator);
// find delimiters
var start: usize = 0;
for (buf) |char, index| {
if (char == delimiter) {
// add to arraylist only if slice is not all delimiters

I expect there would only be a need for single byte delimiters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants