count


Description:

public static int count (string? s, string? substr)

Count the number of non-overlapping occurrences of substr in s.

Example:

    assert (Strings.count ("abcabc", "abc") == 2);
assert (Strings.count ("hello", "xyz") == 0);

Parameters:

s

the string to search in.

substr

the substring to count.

Returns:

number of occurrences.