Giter Site home page Giter Site logo

Comments (7)

Erk- avatar Erk- commented on May 25, 2024 1

I have thought about using something like https://crates.io/crates/unicase which would handle case insensitivity

from twilight.

HiruNya avatar HiruNya commented on May 25, 2024

Would it only have to be case insensitive for ASCII characters?
I ask because str::eq_ignore_ascii_case only works for ASCII characters and the other possible ways I can think of implementing this require extra String allocations due to the possibility of Unicode characters changing length.

from twilight.

HiruNya avatar HiruNya commented on May 25, 2024

Ah yes, that should work. Thanks!

from twilight.

Erk- avatar Erk- commented on May 25, 2024

Actually it may be harder than that, at least with the way the parser is currently structured. As you can not use UniCase in .start_with which may be an issue if we supports non separated commands.
Non seperated commands also gives the other issue that it may not always give the same result, but I will have to look a bit more into that and open a new issue.

from twilight.

HiruNya avatar HiruNya commented on May 25, 2024

Yeah I hit that part last night.
I was able to make it work on the assumption that the length would be the same so that a command like !weiß would able to match on !WEISS as ß and SS are both two bytes. However characters like wont match on FF.
I played around with a few of these characters but I can't really figure out a way to make them work.
For future reference, the Unicode website has a text file called SpecialCasing.txt with characters that go from one to many characters when upper cased.

from twilight.

Erk- avatar Erk- commented on May 25, 2024

Also with that assumption you are going to run into problems with Greek small sigma, as you don't know if is the end of the word, but if we go with the fix in #81 for #80 it should be possible to do with unicase.

from twilight.

HiruNya avatar HiruNya commented on May 25, 2024

Sigma is one of the cases where the assumption would actually work as all three variants are 2 bytes long.

Regarding fix #81, wouldn't using trim_start_matches allow the command to be repeated (e.g. the command "echo" would match "echoecho") and in that case would unicase work?

from twilight.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.