Skip to content

__strchr__

strings · scripts/strings/__strchr__.m

: idx = strchr (str, chars)
: idx = strchr (str, chars, n)
: idx = strchr (str, chars, n, direction)
: [i, j] = strchr (…)

Locate the characters of str that belong to the set chars.

The result is what find gives for the mask of such characters. With n, only the first n matches are kept, or the last n when direction is "last"; they stay in ascending order.