index_caseInsensitive

A function that can be used in Formulas.

Syntax and semantics

index_caseInsensitive (string$, part$)
return the first location of the substring part$ inside string$, or 0 if not found.
index_caseInsensitive (strings$#, s$)
look up whether and where s$ first occurs in strings$#.

Case insensitivity

For determining where the substring is located, it doesn’t matter whether string$ and/or part$ are in lower case or upper case. Here is a comparison with index:

    assert index ("hello", "L") = 0
    assert index_caseInsensitive ("hello", "L") = 3
    assert index ("heLlo", "L") = 3
    assert index_caseInsensitive ("heLlo", "L") = 3
    assert index ("helLo", "L") = 4
    assert index_caseInsensitive ("helLo", "L") = 3
    assert index ("heLLo", "L") = 3
    assert index_caseInsensitive ("heLLo", "L") = 3

See also

rindex_caseInsensitive for the last occurrence
index for case-sensitive matching

Links to this page


© Paul Boersma 2023