Case insensitive string operations

  1. 4 years ago

    Marc

    21 Jun 2019 User since 2018
    Edited 4 years ago by Marc

    For functions that need to compare/find a string, I would like to have the option to have it work case insensitive.

    This now doesn't work:

    "abc".replace("A", "X")
    // doesn't replace "a" with "X"; expected result: Xbc
    
    var list = ["a", "b"]
    var result = list.contains["A"]
    // result is false; expected result: true

    In other languages, like .NET, you can pass an extra StringComparison enum parameter, with an argument like "InvariantCultureIgnoreCase".

    In my experience most string operations need to be handled case *in*sensitive.

or Sign Up to reply!