StringSearch.containsChar

Tells whether the first length characters of str, starting fromo start, contain value. If greater, length is truncated to the length of str.

  1. bool containsChar(Char[] str, Char value, size_t start, size_t length)
    struct StringSearch(bool wide_char = false)
    static
    bool
    containsChar
    (
    in Char[] str
    ,,
    size_t start
    ,
    size_t length
    )
  2. bool containsChar(Char[] str, Char value, size_t start)

Parameters

str Char[]

string to search for value

value Char

value to search for

start size_t

start index

length size_t

number of elements to examine

Return Value

Type: bool

true if str contains value or false otherwise

Examples

test(!StringSearch!().containsChar("Hello", 'l', 5, size_t.max));
test(StringSearch!().containsChar("Hello", 'l', 2, size_t.max));
test(StringSearch!().containsChar("Hello", 'l', 3, size_t.max));
test(!StringSearch!().containsChar("Hello", 'o', 5, size_t.max));
test(StringSearch!().containsChar("Hello", 'o', 4, size_t.max));
test(StringSearch!().containsChar("Hello", 'o', 0, size_t.max));

test(!StringSearch!().containsChar("Hello", 'l', 0, 0));
test(!StringSearch!().containsChar("Hello", 'l', 0, 2));
test(StringSearch!().containsChar("Hello", 'l', 0, 3));

Meta