Skip to content

Three-way comparison function for strings #364

Open
@ChetanKarwa

Description

@ChetanKarwa

I went through the stdlib_string_type module and I want to recommend some changes. Correct me if I am wrong at any point.

  • The lgt, llt, lge and lle work very similarly to the operators >, <, >=, <= respectively according to me there is not much need for all these functions.
  • Instead of all these we can have a general function compare(str1,str2) this function will return an integer value:
    • 1 if str1 is lexicographically greater than str2,
    • 0 if str1 is lexicographically equal to str2,
    • -1 if str1 is lexicographically smaller than str2.
  • We can also include a function like compare_ignore_case(str1,str2) this function is similar to compare but is not case sensitive. (can improve nomenclature of the functions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    ideaProposition of an idea and opening an issue to discuss ittopic: stringsString processing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions