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

Case insensitive substring test function #2442

Merged
merged 1 commit into from
May 21, 2024
Merged

Conversation

cuihtlauac
Copy link
Collaborator

No description provided.

@cuihtlauac cuihtlauac merged commit 383889c into main May 21, 2024
2 of 3 checks passed
@cuihtlauac cuihtlauac deleted the is-sub-ignore-case branch May 21, 2024 11:25
let name_contains_s { name; _ } =
String.contains_s (String.lowercase_ascii name) pattern
in
let name_contains_s { name; _ } = String.is_sub_ignore_case pattern name in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems a bit perilous to assume that names fit in the ascii subset of English?

Copy link
Collaborator Author

@cuihtlauac cuihtlauac May 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right; it is not. Not sure how to handle this nicely here. This commit is just a refactoring. Any clues?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If pulling uucp as dependency is ok: https://erratique.ch/software/uucp/doc/Uucp/Case/index.html#caselesseq looks like a good alternative to the lowercase_ascii normalization (even if does not cover "lookalike" search).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good idea. Uucp is already part of ocamlorg dependencies (by transitivity) so there's no downside to this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue on this: #2444

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

Successfully merging this pull request may close these issues.

2 participants